The AgentRef contract in one minute
- Install the script on every page where affiliate traffic can land or where checkout can start.
- Set the program website in AgentRef to the same root domain that serves the script.
- Keep the user journey on the same root domain when possible.
www.example.comandapp.example.comwork well together. Different roots likeexample.comandexample-store.comdo not share first-party cookies. - If you use Stripe Payment Links, Buy Buttons, or Pricing Tables on the same page, the script is usually enough.
- If you create Stripe Checkout Sessions yourself, read
window.AgentRef.getCheckoutMetadata()and pass it into Stripe metadata. See the Stripe guide below. - If a platform uses its own native ecommerce checkout, do not assume automatic attribution. Several builder guides call this out explicitly.
Framework guides
Next.js
App Router and Pages Router installation for full-site tracking.
React
Install once in your app shell without duplicate script injection.
Vue.js
Recommended setup for Vue SPAs and static Vue sites.
Nuxt
Add AgentRef through
nuxt.config.ts or a shared layout.Astro
Install in a reusable Astro layout that covers all landing pages.
Svelte
SvelteKit and plain Svelte installation options.
Website builder guides
WordPress
Theme, plugin, and child-theme options for site-wide tracking.
Shopify
Theme installation plus a clear note about Shopify native checkout limits.
Webflow
Site-wide custom code setup for published Webflow sites.
Framer
Framer custom-code setup without extra helper scripts.
Wix
Add the script through Wix custom code on all published pages.
Squarespace
Use code injection for a global AgentRef install.
Stripe guide
Stripe Checkout Integration
Covers hosted Stripe surfaces, custom Checkout Sessions, metadata, and verification.
Verify any installation
Open a real affiliate link
Use a live test link from AgentRef so the visitor arrives with a real referral parameter like
?ref=abc123.Confirm the cookies exist
In browser DevTools, check that
agentref_cid and agentref_pid exist after the page loads.Run a debug pass
Add
?agentref_debug=1 to the URL and inspect the browser console. You can also use ?agentref_verify=1 on a live page to trigger a tracking-install verification hit.Related docs
JavaScript Snippet
Core script behavior, cookies, parameters, and the DOM API.
Consent and GDPR
How to gate AgentRef until the visitor grants consent.
Debug Mode
Inspect runtime state, warnings, and hosted Stripe instrumentation.