Tracking conversions (JavaScript)
When a tracked visitor completes a goal — a purchase, signup, or lead — record it from the browser with window.ConverStream.trackConversion. The tracker automatically attaches the click id it stored in the first-party cookie, so you only pass the conversion details.
Usage
Call this on your confirmation or thank-you page:
window.ConverStream.trackConversion({
revenue: 50.00,
currency: "USD",
external_conversion_id: "order_123"
});
| Field | Description |
|---|---|
revenue | Conversion value as a number. |
currency | ISO currency code, e.g. "USD". |
external_conversion_id | Your own order or transaction id, used to de-duplicate and reconcile. |
What it sends
The helper posts to POST /api/v1/conversions using your public site key:
{
"site_key": "PUBLIC_SITE_KEY",
"click_id": "xyz789",
"revenue": 50.00,
"currency": "USD",
"external_conversion_id": "order_123"
}
Response 202 Accepted:
{ "success": true }
Error 401 Unauthorized:
{ "error": "unauthorized" }
Browser-side conversion tracking is convenient, but values set in the browser can be altered by the user. For trustworthy revenue data — especially for billing or payouts — record conversions from your server instead.