Skip to content
Docs

Track revenue

Attach an amount to any event, from the browser or your backend, and see revenue by source, campaign, country and device.

Amounts are integers

Revenue is always the smallest currency unit: cents, paise, pence. 4900 means $49.00. Floats are rounded. Server-side amounts are clamped to 0–1,000,000,000 cents; browser amounts have a lower limit (below). Amounts are stored as sent with no currency conversion, and the dashboard shows every amount with a $ sign, so send one currency per site.

From the browser

window.linqry('purchase', { plan: 'pro' }, 4900);

Revenue sent from the browser is untrusted: anyone can call window.linqry() from your page. A browser event carrying more than 1,000,000 cents ($10,000) is rejected, and because the browser endpoint always answers 204 the drop is silent. Send larger or money-critical amounts from your backend with the write key (up to 1,000,000,000 cents per event).

From your backend

Send the event where the payment is actually confirmed: a Stripe/Razorpay webhook, a background job. Pass the landing url (with its UTM parameters) and referrer you captured at signup if you want the revenue attributed to a channel. A server-side event carries exactly the url and referrer you send and inherits nothing from other events; without them its revenue is reported under direct / (none).

curl -X POST https://linqry.com/api/track \
  -H 'authorization: Bearer YOUR_WRITE_KEY' \
  -H 'content-type: application/json' \
  -d '{
    "siteId": "YOUR_SITE_ID",
    "event": "subscription-renewed",
    "url": "https://yourdomain.com/pricing?utm_source=newsletter",
    "properties": { "plan": "pro" },
    "revenue": 4900
  }'

The full payload reference, rate limits and error codes are on the HTTP API page.

/api/revenue

curl -X POST https://linqry.com/api/revenue \
  -H 'authorization: Bearer YOUR_WRITE_KEY' \
  -H 'content-type: application/json' \
  -d '{ "siteId": "YOUR_SITE_ID", "amount_cents": 4900, "currency": "USD",
        "email": "buyer@example.com" }'

Records a revenue event. Optional fields: ts is an ISO-8601 time in the last 7 days (a few minutes ahead is tolerated for clock skew; later times are rejected). visitor_id is the visitor hash shown in the dashboard’s visitor panel; hashes rotate daily, so it only matches that visitor’s events from the same UTC day, and the tracker does not expose it to your page or backend. Without it the revenue is stored unattributed and is not counted as a buyer. email is never stored, only a keyed hash of the lower-cased address (props.emailHash, an HMAC that is stable per site), so you can de-duplicate without the address itself being kept. Same auth and error shape as /api/track; success is 200 { "ok": true, "attributed": true|false }.

How attribution works

Browser events carry the referrer and UTM parameters of the visit they happened in, plus the visitor’s country, device, OS and browser. The Insights page shows revenue, buyers and conversion rate by country, referrer and UTM source, and revenue share by device, OS and browser. To see revenue for one campaign, device, OS or browser, filter the dashboard (for example ?utm_campaign=spring-launch). Server-side events are attributed to the server that sends them: their country, device, OS and browser are your server’s. Only the url and referrer you send decide their channel; without them the revenue is reported under direct / (none).

Because visitor IDs rotate daily, attribution is scoped to the day the revenue event happened: a visitor who arrived from a campaign last week and paid today is, today, a direct visitor unless your backend passes the original landing URL with the revenue event. That is the trade-off for having no persistent identifier.

Revenue attribution, with examples →