Skip to main content
Svelte and SvelteKit both work well with AgentRef as long as the script is installed in the global shell instead of a page-specific component.

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.
Install the script in src/app.html so it is available across all routes.

Checkout compatibility in Svelte

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

  1. Open the live app through a real affiliate link.
  2. Confirm agentref_cid and agentref_pid in browser cookies.
  3. Add ?agentref_debug=1 and inspect the console.
  4. Complete one supported checkout flow and verify the conversion in AgentRef.

Troubleshooting

  • window.AgentRef is 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.

Stripe Checkout

Metadata bridge for custom Stripe sessions.

Consent and GDPR

Coordinate AgentRef with your consent banner.

Debug Mode

Runtime inspection and troubleshooting.