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)
- Open Chrome and navigate to
chrome://extensions
- Enable Developer mode (toggle in top-right)
- Click Load unpacked
- Select the
chrome-extension/ directory from the project root
- The extension icon should appear in your toolbar
How Sync Works
- User clicks “Sync” in the HostMetrics web app (or extension popup)
- Extension navigates to Turo’s earnings page
- Content script intercepts the page data
- Data is sent to HostMetrics via
POST /api/turo/sync
- Server parses CSV, deduplicates, and inserts records
Communication Flow
Distributing the Extension
For non-developers, the extension is distributed as a .zip file:
- Zip the
chrome-extension/ directory
- Place at
public/downloads/hostmetrics-turo-sync.zip
- 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.