Skip to main content
Nuxt is a strong fit for AgentRef because you can register the tracking script globally and let it stay active across route changes.

Before you start

  • Set the program website in AgentRef to the same root domain your Nuxt app uses.
  • Copy the exact script snippet from Settings -> Integration.
  • If checkout starts on another subdomain, install AgentRef there too.
The cleanest Nuxt installation is a global head script in nuxt.config.ts.
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          src: 'https://www.agentref.co/api/tracking/script.js?pid=YOUR_PROGRAM_ID',
          defer: true,
        },
      ],
    },
  },
});

Checkout compatibility in Nuxt

Checkout patternRecommendation
Hosted Stripe surfaces on Nuxt pagesSupported directly.
Nuxt server routes or backend create Checkout SessionsSupported, but you must bridge window.AgentRef.getCheckoutMetadata() into Stripe metadata.
Cross-root-domain checkoutNot automatic. First-party cookies stay on one root domain.

Nuxt-specific notes

  • Install once globally instead of per page.
  • AgentRef works well with route changes because the script remains loaded after hydration.
  • If you enable consent mode, call window.AgentRef.setConsent('granted') from your banner integration after opt-in.

Verify the installation

  1. Visit the Nuxt app through a live 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 Stripe test checkout and confirm AgentRef records the conversion.

Troubleshooting

  • The script only loads on one route: move it into nuxt.config.ts or a shared app-level layout.
  • Clicks appear but no conversion does: your custom session path still needs the Stripe guide.
  • Consent is required but cookies never appear: your banner integration probably never calls window.AgentRef.setConsent('granted').

Stripe Checkout

Required for custom session creation on the server.

Consent and GDPR

Gate tracking until the user accepts.

Debug Mode

Inspect runtime state and warnings.