Before you start
- Set the program website in AgentRef to the same root domain your app serves.
- Copy the exact script snippet from
Settings -> Integration. - If your app and checkout start on different subdomains, install AgentRef on both.
Recommended installation
- SvelteKit
- Plain Svelte
Install the script in
src/app.html so it is available across all routes.Checkout compatibility in Svelte
| Checkout pattern | Recommendation |
|---|---|
| Hosted Stripe surfaces on Svelte pages | Supported directly. |
| Custom Checkout Sessions created by your server | Supported with the Stripe guide. |
| Checkout on a different root domain | Not automatic because AgentRef uses first-party cookies. |
Svelte-specific notes
- Do not reinstall AgentRef in
onMount()for every route. One shell-level install is enough. - Hosted Stripe elements rendered after hydration are still observed automatically.
- If you gate cookies behind consent, call
window.AgentRef.setConsent('granted')after opt-in.
Verify the installation
- Open the live app through a real affiliate link.
- Confirm
agentref_cidandagentref_pidin browser cookies. - Add
?agentref_debug=1and inspect the console. - Complete one supported checkout flow and verify the conversion in AgentRef.
Troubleshooting
window.AgentRefis undefined: the script was not installed in the global shell.- Clicks appear but conversions do not: your custom checkout path still needs the Stripe metadata bridge.
- Cookies fail across domains: move the journey onto one root or handle the handoff server-side.
Related docs
Stripe Checkout
Metadata bridge for custom Stripe sessions.
Consent and GDPR
Coordinate AgentRef with your consent banner.
Debug Mode
Runtime inspection and troubleshooting.