Skip to main content

Chrome Extension Setup

The HostMetrics Chrome extension automatically syncs trip earnings data from Turo’s website.

Extension Architecture

The extension consists of:
  • Service Worker (background/service-worker.js) — Orchestrates sync
  • Content Scripts — Intercept Turo page data
  • Popup UI — User interface for triggering sync
  • Bridge Script — Communicates between extension and HostMetrics web app

Loading the Extension (Development)

  1. Open Chrome and navigate to chrome://extensions
  2. Enable Developer mode (toggle in top-right)
  3. Click Load unpacked
  4. Select the chrome-extension/ directory from the project root
  5. The extension icon should appear in your toolbar

How Sync Works

  1. User clicks “Sync” in the HostMetrics web app (or extension popup)
  2. Extension navigates to Turo’s earnings page
  3. Content script intercepts the page data
  4. Data is sent to HostMetrics via POST /api/turo/sync
  5. Server parses CSV, deduplicates, and inserts records

Communication Flow

Distributing the Extension

For non-developers, the extension is distributed as a .zip file:
  1. Zip the chrome-extension/ directory
  2. Place at public/downloads/hostmetrics-turo-sync.zip
  3. Users download from the Data Sources page and load it manually
The extension requires the user to be logged into both Turo and HostMetrics. If the Turo session expires, the sync will emit a hm:turo-login-required event.