Nuxt

Install Partnersify tracking on Nuxt, pixel setup via useHead and reading the affiliate cookie in Nitro server routes.

Nuxt merchants using server-side Checkout Sessions read the affiliate cookie in Nitro and forward it to Stripe. Here's the full setup.

Step 1: Add the pixel

The cleanest approach is nuxt.config.ts to inject the pixel globally:

// nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          innerHTML: `window.partnersify = window.partnersify || function() { (window.partnersify.q = window.partnersify.q || []).push(arguments); };`,
          tagPriority: 'critical',
        },
        {
          src: 'https://partnersify.com/partner.js',
          'data-partnersify': 'YOUR_MERCHANT_ID',
          async: true,
        },
      ],
    },
  },
});

Replace YOUR_MERCHANT_ID with the ID from Setup → Install tracking.

Alternatively, add to your root app.vue using useHead():

useHead({
  script: [
    {
      innerHTML: `window.partnersify = window.partnersify || function() { (window.partnersify.q = window.partnersify.q || []).push(arguments); };`,
    },
    {
      src: 'https://partnersify.com/partner.js',
      'data-partnersify': 'YOUR_MERCHANT_ID',
      async: true,
    },
  ],
});

In your Nitro API route, read the psfy_partner cookie and include it in the Checkout Session metadata:

// server/api/checkout.post.ts
import Stripe from 'stripe';
import { getCookie } from 'h3';

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export default defineEventHandler(async (event) => {
  const partner = getCookie(event, 'psfy_partner') ?? null;

  const session = await stripe.checkout.sessions.create({
    // ... your line items, success_url, etc.
    metadata: {
      psfy_partner: partner,
    },
  });

  return { url: session.url };
});

Partnersify reads metadata.psfy_partner from the Stripe webhook and attributes the sale to the correct affiliate.

Step 3: Test it

  1. Sign up as an affiliate on your own portal
  2. Visit your site via the affiliate referral link
  3. Run the Test Pixel check at Setup → Install tracking
  4. Complete a test Stripe checkout using a test card
  5. The attributed sale should appear in Sales within 30 seconds

If your Nuxt site links to Stripe Payment Links, no server code is needed. The pixel handles attribution automatically.

Updated