Guides
Tracking sales on your own site
Affiliate links, the first-party tracking script, headless Shopify carts, Stripe and server-side sales.
Affiliate links
Each creator's link has the form https://creator.growthdept.ai/r/<code>. Opening it logs the click and redirects to the campaign's destination with gd_click (the click id) and gd_ref (the creator's tag) added.
The tracking script
Add the script from Settings, Developer before </head> on every page. It keeps the click id and tag in cookies on your own domain for the campaign's cookie window and reports page views and carts.
<script src="https://creator.growthdept.ai/t/<your public id>.js" async></script>The browser script can only report views and carts. Sales come from your store, Stripe or your server, so they cannot be faked from a browser.
Headless Shopify carts
On a headless storefront, add the script's cart attributes to the cart so the order carries the creator:
const attributes = window.gdCreator?.cartAttributes() ?? [];
// pass attributes to cartCreate or cartAttributesUpdateStripe
For Stripe Checkout, Payment Links and invoices, add the script's metadata when you create the session:
const metadata = window.gdCreator?.stripeMetadata() ?? {};
// send metadata to your server and pass it to stripe.checkout.sessions.createThe metadata also sets growi_affiliate_code, and the script sets window.growi.affiliate_code, so existing integrations that read those names keep working.
To have the payments credited without writing server code, open the Stripe card in Settings, Integrations, add a webhook endpoint in your Stripe account at the address shown there, and paste its signing secret. Growth Dept Creator then reads checkout.session.completed, payment_intent.succeeded and charge.refunded from your account.
Sales from your server
For a custom checkout or an app, send each order with POST /affiliate_sales. A repeat of the same order_id and platform answers 200 with the existing sale instead of making a second one, so retries are safe.
Request
curl -X POST https://creator.growthdept.ai/api/public/v1/affiliate_sales \
-H "Authorization: Bearer gdc_..." \
-H "Content-Type: application/json" \
-d '{"campaign_affiliate_id": "4096", "order_id": "1001", "total": 8400, "subtotal": 8000, "currency": "usd", "platform": "website"}'Amounts are in cents. Or send checkout_completed and payment_completed events with POST /tracking_events. The field lists are on the reference pages.