AttribIQ browser attribution API
Reference for reading AttribIQ visitor, session, landing page, referrer, and UTM context before checkout starts.
The browser attribution API exposes the current AttribIQ project, visitor, session, landing page, referrer, and UTM context. Send this object to your backend when checkout starts.
- Read attribution from window.attribiq
- Understand the fields in the attribution object
- Send attribution safely to your backend
- Avoid trusting browser-provided data for billing decisions
The browser attribution API exposes the visit context that should travel into checkout.
Use it when a visitor clicks upgrade, starts checkout, creates a paid account, or begins any flow that can produce revenue.
Read the object
const attribution = window.attribiq.getAttribution()
Expected shape:
{
"project_id": "proj_123",
"visitor_id": "v_abc",
"session_id": "s_def",
"landing_page": "/pricing",
"referrer": "https://google.com",
"utm_source": "google",
"utm_campaign": "brand-search"
}
Required fields
The minimum useful fields are:
project_idvisitor_idsession_id
Landing page, referrer, and UTM values are useful for debugging, but the stable identifiers are what let AttribIQ join payment events to analytics sessions.
Send attribution to your backend
await fetch("/api/create-checkout-session", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
price_id: "price_123",
attribution
})
})
Your backend should validate the shape, ignore unknown fields, and decide which values to put into Stripe metadata or your own pending checkout record.
Security boundaries
Do not use browser attribution to decide:
- Payment amount.
- Plan entitlement.
- Billing currency.
- User account ownership.
- Discount eligibility.
The browser attribution object is for reporting. Billing decisions belong on the server.
Next steps
Use pass attribution to Stripe Checkout for a full Stripe flow, or Payment API reference for custom billing.
FAQ
Can the browser attribution object be trusted?
Treat it as client-provided attribution context, not as billing authority. Validate shape and project ownership server-side.
Which fields are required for revenue attribution?
project_id, visitor_id, and session_id are the minimum useful fields.
Should I send the entire object to Stripe?
No. Send the object to your backend, then copy the stable identifiers into Stripe metadata.
Can I store the object with my own checkout session?
Yes. Storing it with your own pending checkout record can make webhook reconciliation easier.
Connect payments to the dashboard
Install the tracker, pass attribution into checkout, and report revenue by source, campaign, landing page, and path.
Related guides
Web tracker reference
Install the AttribIQ browser tracker and collect sessions, pageviews, referrers, UTMs, custom events, goals, and checkout context.
Payment API reference
Reference for sending custom revenue events to AttribIQ with idempotency, normalized event types, and attribution identifiers.
AttribIQ CLI reports
Run AttribIQ overview, revenue, campaign, goal, and funnel reports from scripts, release checks, and internal tools.