Install the Sarge pixel and prove every conversion path.
Add one hosted script, emit stable ecommerce events, keep existing media pixels in place, and verify the event stream from the matching Production, Staging, or Development environment.
Project dashboard
Select Production, Staging, or Development, then choose a tab. The selected environment stays selected as you navigate.
- Overview
- Traffic, trends, and event mix for this environment.
- Sessions
- Follow users and sessions through your site.
- Live events
- Inspect incoming events and their captured properties.
- Diagnostics
- Review tracking issues and recommended fixes.
- Setup
- Install your pixel, test tracking, and connect integrations.
- Settings
- Manage privacy and data controls for this project.
Overview counts real traffic, excluding test and watchdog events. Sessions loads 80 matching events at a time; load more before treating a journey as complete. Live events shows the latest 12 events. Diagnostics is available for Production on Growth and higher.
Organization admins manage credentials in Setup → Server-side calls and privacy controls in Settings. API export and MCP read access are available on every plan, including Free. Server-event secrets and partner postbacks require Starter or higher.
Hosted pixel snippet
Copy the exact snippet from Setup → Install pixel for the selected environment. The browser/API payload field is still called `siteId`, but the value is the selected environment ID.
<script>
window._sarge = { queue: [["track", "page.view"]] };
</script>
<script async src="https://track.sargetrack.app/pixel.js?env={siteEnvironmentId}"></script> Place it in the document head or as early as possible in the page body. The queued `page.view` call is replayed after `pixel.js` loads. Emit the initial page view once, then another on each SPA route change. Call `window.sarge` only after it loads; earlier calls must use the queue shown in the Markdown guide.
Track ecommerce events
Call `window.sarge("track", eventName, properties)` near the action that actually changed state. Use stable, lowercase, dot-separated event names and JSON-serializable properties.
| Event | When | Required |
|---|---|---|
| page.view | Page load and SPA route changes. | path, title |
| product.viewed | Product detail, quick view, or product inspection. | product_id |
| cart.added | A product is successfully added to cart. | product_id, price |
| checkout.started | Checkout starts. | value, currency |
| purchase.completed | Payment succeeds and an order is created. | order_id, value, currency |
window.sarge("track", "product.viewed", {
product_id: "field-flask",
product_name: "Field Flask",
price: 42,
currency: "USD"
}); window.sarge("track", "cart.added", {
product_id: "field-flask",
product_name: "Field Flask",
price: 42,
currency: "USD",
cart_size: 1
}); window.sarge("track", "purchase.completed", {
order_id: "order_123",
value: 84,
currency: "USD",
item_count: 2
}); Watch other pixels
Sarge observes vendor functions present at installation or assigned later while preserving their queues and behavior. Missing vendor globals stay undefined so normal bootstrap scripts can run. Earlier calls, protected globals, and calls during script declarations before hooks refresh may escape observation; verify the actual vendor events.
fbq(...)
meta.pixel.fire
gtag(...)
google.tag.fire
dataLayer.push(...)
data_layer.push
SPA route changes
Client-side routed apps should emit another `page.view` whenever the route changes.
window.sarge("track", "page.view", {
path: window.location.pathname,
title: document.title
}); Test impersonation
- Copy the user ID you want to test from the Sarge project page.
- Open the tracked site, then open the browser console on that page.
- Run
impersonate(userId)before starting the checkout or account flow. - Run
clear_impersonation()when the test is finished.
impersonate('customer_123'); clear_impersonation(); While impersonation is active, browser events use the impersonated value as `userId` and are marked with Sarge test metadata. This is only debug labeling; it does not authenticate as that user in the tracked site.
Affiliate tracking and latents
The pixel reads `sarge_ref` and `sarge_aff` URL parameters, stores them in localStorage, and attaches them to later browser events during the environment attribution window.
https://shop.example.com/?sarge_ref=summer-campaign&sarge_aff=partner-42 Use `sarge_ref` for the campaign, placement, click ID, or network click identifier. Use `sarge_aff` for the affiliate, creator, publisher, or partner ID.
Latent conversions
Sarge defaults to a 28-day attribution window, checked when the pixel initializes. Later browser events retain that attribution across page loads within the window; a page left open past expiration can continue sending its loaded attribution. For server-confirmed orders or affiliate.conversion callbacks, explicitly send the attribution and matching identifiers from your backend.
Server-side and postback events
Use browser events for page and interaction tracking. Use server-side events for trusted backend facts such as paid orders, refunds, fulfilled subscriptions, or webhook confirmations. Organization admins create the credentials in Setup → Server-side calls on Starter and higher.
curl -X POST "https://track.sargetrack.app/v2/server/events" \
-H "authorization: Bearer {serverEventSecret}" \
-H "content-type: application/json" \
-d '{
"siteId": "{siteEnvironmentId}",
"name": "purchase.completed",
"eventId": "order_123",
"userId": "customer_123",
"properties": {
"order_id": "order_123",
"value": 129.99,
"currency": "USD"
}
}' If the backend also calls Meta, Google, or another vendor API directly, report that upstream dispatch as a watchdog event with `transport: "server"` and the returned HTTP status in `properties.upstream`. Add `properties.implementation.note` when AI reviews need project-specific context.
curl -X POST "https://track.sargetrack.app/v2/server/events" \
-H "authorization: Bearer {serverEventSecret}" \
-H "content-type: application/json" \
-d '{
"siteId": "{siteEnvironmentId}",
"name": "meta.pixel.fire",
"eventId": "order_123_meta_purchase",
"sessionId": "sess_123",
"userId": "customer_123",
"properties": {
"vendor": "meta",
"transport": "server",
"command": "track",
"event_name": "Purchase",
"payload": { "order_id": "order_123", "value": 129.99, "currency": "USD" },
"upstream": {
"endpoint": "https://graph.facebook.com/{api_version}/{pixel_id}/events",
"status": 200,
"ok": true,
"request_id": "fb_req_123"
},
"implementation": {
"mode": "server_gtm",
"note": "This project does not fire fbq directly. Meta Purchase is dispatched server-side through GTM."
}
}
}' URL-only partner postbacks are useful when an affiliate network can only call a tracking URL. Keep server event secrets out of browser code and rotate postback tokens if a URL is exposed.
https://track.sargetrack.app/v2/postback/{siteEnvironmentId}/{postbackToken}?event=affiliate.conversion&click_id=click_123&order_id=order_123&value=42.50¤cy=USD&aff=partner-42 Webhooks
Webhook destinations belong to the selected project environment. Organization admins on Starter and higher can configure them in Setup.
- Open the project, select the environment, and open the Setup tab.
- In Webhooks, enter a name and an HTTPS destination URL.
- Optionally enter event names separated by commas or newlines, such as
purchase.completed. Leave filters blank to select all events. - Select Create webhook and copy the signing secret into secure storage. It is shown only once.
Outbound event delivery is not implemented yet. Saving a destination stores its configuration; the configured status does not confirm delivery. Use the read-only export API to retrieve events from your backend today.
Verify installation
- Open the target site in a browser.
- Open the Sarge portal and select the matching environment.
- Trigger the page, product, cart, checkout, and purchase actions you wired.
- Confirm names and payloads in Live events, inspect journeys in Sessions, and review Production findings in Diagnostics.
For coding-agent verification, an editor or organization admin can select Create 30-minute verify link in Setup → Install pixel. Anyone holding the link can see up to 30 recent events until it expires; share it only with the intended tester or agent:
https://sargetrack.app/verify/{siteEnvironmentId}?key={temporaryVerificationKey}