Creem revenue attribution

Tie paid Creem customers back to the campaign that brought them in.

Two steps: pass the visitor id as checkout metadata, and point a Creem webhook at Piqo.

1. Pass the visitor id into checkout

Attach the visitor id to the checkout's metadata. Creem forwards it to Piqo on the webhook. Using the official @creem_io/nextjs adapter this is two small pieces.

First, the adapter's checkout route handler (standard setup — it powers the button below):

// app/checkout/route.ts
import { Checkout } from '@creem_io/nextjs';

export const GET = Checkout({
  apiKey: process.env.CREEM_API_KEY!,
  testMode: true, // flip to false in production
  defaultSuccessUrl: '/thank-you',
});

Then attach piqo_visitor_id via the metadata prop on the <CreemCheckout> component — this is the part that actually carries the visitor id through to the webhook:

'use client';
import { CreemCheckout } from '@creem_io/nextjs';

export function BuyButton() {
  return (
    <CreemCheckout
      productId="prod_abc123"
      successUrl="/thank-you"
      metadata={{
        piqo_visitor_id: getCookie('piqo_visitor'), // your own visitor id
        piqo_session_id: getCookie('piqo_session'), // optional
      }}
    >
      <button>Buy Now</button>
    </CreemCheckout>
  );
}

Not on Next.js? Whether you use the Creem REST API or TypeScript SDK, set the same metadata on the checkout you create — the field name is identical.

2. Add the Piqo webhook in Creem

  1. In Piqo, open your site's Settings → Creem and copy the webhook URL shown there (it ends in your site key).
  2. In Creem, go to Developers → Webhooks, add that URL, and subscribe to the checkout.completed event. If you sell subscriptions, also subscribe to subscription.paid so every recurring renewal is tracked, not just the first payment.
  3. Copy the signing secret Creem generates and paste it back into Piqo's Creem settings. That secret lets Piqo verify the webhooks are genuine.

What you'll see

As soon as a customer pays, Creem calls the webhook and the conversion shows up on your dashboard's Conversions page with the channel / country / UTM columns from the matching pageview, and its revenue lands on the chart. Payments without the metadata still count toward revenue totals — they just show as Direct.

Where does the visitor id come from? Keep your own — generate a UUID on first pageview, store it in a first-party cookie, and pass that string. Any opaque, stable token works.