Chrome Extension Sync
The HostMetrics Chrome extension provides a one-click alternative to manual CSV downloads. It scrapes trip earnings data directly from Turo’s website and sends it to HostMetrics for import.What the Extension Does
Instead of downloading a CSV from Turo and uploading it to HostMetrics, the extension:- Reads trip earnings data from the Turo dashboard page
- Packages the data in the same format as a Trip Earnings CSV
- Sends it to the HostMetrics API for processing
- Shows sync progress and results in the extension popup
Installation
The extension can be installed two ways:- Chrome Web Store — Install directly from the store listing
- Manual install — Download the ZIP from HostMetrics and load as an unpacked extension in
chrome://extensions
Sync Flow
Content Scripts
Content Scripts
turo-earnings.js— Scrapes trip earnings data from the Turo earnings pageturo-page-interceptor.js— Intercepts Turo API responses for additional data capturehostmetrics-bridge.js— Bridges communication between the Turo page context and the extension
Background Service Worker
Background Service Worker
service-worker.js handles the extension lifecycle, manages authentication state, and coordinates data transfer between content scripts and the HostMetrics API.Popup UI
Popup UI
popup.js renders the extension popup with sync button, progress bar, last sync timestamp, and error messages.Progress Tracking
During sync, the extension popup shows:- Current step (reading data, sending to server, processing)
- Progress percentage
- Number of trips found
- Estimated time remaining
Error States
| Error | Cause | Resolution |
|---|---|---|
| Turo login required | User is not logged in to Turo | Log in to Turo in the same browser |
| Network error | Cannot reach HostMetrics API | Check internet connection, verify API URL |
| No data found | Extension could not find earnings on the page | Navigate to the Turo earnings page first |
| Import failed | Server-side processing error | Check HostMetrics for error details |
The extension requires the user to be on the Turo earnings page (
turo.com/us/en/account/earnings) for the scrape to work. The extension popup will prompt navigation if needed.Last Sync Display
TheTuroSyncStatus component on the Data Sources page shows:
- Last successful sync timestamp
- Number of trips synced
- Sync source (extension vs manual CSV)
ExtensionSyncButton component provides an in-app trigger that communicates with the installed extension.
Extension Files
| File | Purpose |
|---|---|
chrome-extension/background/service-worker.js | Extension lifecycle and API communication |
chrome-extension/content/turo-earnings.js | Turo page scraping logic |
chrome-extension/content/turo-page-interceptor.js | API response interception |
chrome-extension/content/hostmetrics-bridge.js | Page-to-extension bridge |
chrome-extension/popup/popup.js | Extension popup UI |
chrome-extension/lib/config.js | API URL and extension configuration |