Before you start
- Set the program website in AgentRef to the same root domain your React app uses.
- Copy the exact AgentRef script snippet from
Settings -> Integration. - If checkout happens on a sibling subdomain, install AgentRef there too.
Recommended installation
- index.html
- Root component fallback
For Vite, CRA, and most React SPAs, the cleanest setup is to add the script directly to the shared HTML shell.
Checkout compatibility in React
SPA-specific notes
- AgentRef does not need to be reloaded on every route change.
- Hosted Stripe surfaces that render after navigation are still covered because the script watches the DOM.
- If you gate cookies behind consent, call
window.AgentRef.setConsent('granted')after the visitor accepts.
Verify the installation
- Land on the app through a real affiliate link.
- Confirm
agentref_cidandagentref_pidin DevTools. - Add
?agentref_debug=1and inspect the console. - Complete one supported checkout flow and confirm AgentRef records the conversion.
Troubleshooting
- The script appears multiple times in the DOM: move the install into
index.htmlor add a duplicate guard. - Referral cookies are missing after a route transition: the problem is usually that the script never loaded on first render.
- Payment Links work but custom checkout does not: that means your React frontend is fine and your Stripe backend still needs the metadata bridge.
Related docs
Stripe Checkout
Bridge browser attribution into Stripe metadata.
Debug Mode
Inspect runtime state and hosted Stripe instrumentation.
Consent and GDPR
Coordinate AgentRef with your consent banner.