Skip to main content

How to Track Affiliate Links on a Custom Website

Custom websites can use Growi affiliate links. Creators share a Growi link; you attribute sales with Shopify scripts, Stripe metadata, or one API request after checkout.

S
Written by Solomon Bassalian

Overview

Yes. Regular custom websites can use Growi affiliate links, including sites that do not use Stripe or Shopify. Creators share a Growi link (for example, growi.io/r/natalie-g). That sends the visitor to your site. You do not build the link system.

You do not send an API request on every click. The only thing Growi needs from a custom site is each completed sale, attributed to the creator's tag.

No Stripe? That is fine. Stripe is optional. If you checkout with WooCommerce, Chargebee, PayPal, or your own payments, skip the Stripe section and use Just send us the sales below. After each order succeeds, your server posts the sale to Growi. That is the whole integration.

Which setup do you have?

Your site

What you send Growi

Any custom checkout (no Shopify, no Stripe)

One API request per completed order. This is the usual path for a custom website.

Shopify theme or Shopify headless

Tracking scripts only. Shopify already sends the orders.

Stripe Checkout, Payment Links, or invoices

growi.js plus the affiliate code in Stripe metadata. Stripe already sends the orders.

Just send us the sales (no Shopify or Stripe)

This is the path if you do not use Shopify checkout and you do not use Stripe. Growi does not need your payment provider. After an order is paid, your backend tells Growi: this order, this amount, this creator.

1. Capture the affiliate tag

When a visitor lands from a Growi link, save the creator's tag (cookie, query param, or window.growi.affiliate_code if you added growi.js) and keep it through checkout.

2. Post the sale from your server

After a successful order, send a POST to the public Affiliate Sales endpoint at api.growi.io/api/public/v1/affiliate_sales. Authenticate with a Bearer token using your public API key. See the Create Affiliate Sale docs for the exact request.

Required fields:

  • order_id — your unique order identifier

  • currency — for example usd, eur, or gbp

  • total or subtotal — amount in cents (9999 is $99.99)

  • campaign_affiliate_id — the creator's affiliate tag/code, not a numeric ID. Or send growi_user_id and growi_campaign_id instead.

Optional: set platform to website (the default). The same order_id plus platform is safe to retry. Growi returns the existing sale instead of creating a duplicate.

Important: Keep the API key on your server. Do not put it in browser JavaScript. You only need to send completed sales. Clicks, page views, and add-to-cart events are optional.

Auth details: API authentication. To change or refund a sale later, use Update Affiliate Sale.

Shopify or Shopify headless

If checkout still runs on Shopify, use the Shopify app instead of posting sales yourself. A custom front end does not change that.

On a standard Shopify theme, turn on the Growi Affiliate Tracking app embed in the theme editor. Full steps: How to Install the Growi Shopify App and Verify It Is Tracking.

On a headless or custom Shopify storefront, add both scripts from shopify.growi.io (embed.js and cookie-utils.js) to the head of the root layout that every page shares. They must load on every page, not just the home page.

Stripe checkout (only if you already use Stripe)

Skip this section if you do not use Stripe. You do not need to add Stripe to use Growi affiliate links.

If you already take payment with Stripe, Growi can read sales from Stripe so you do not post them yourself.

  1. In Growi, go to Settings > Integrations and install Stripe.

  2. Add the growi.js tracking script from cdn.growi.io to your site. Your Public Growi ID is on the same Integrations page.

The script stores the affiliate tag on window.growi.affiliate_code. Pass that value into Stripe metadata as growi_affiliate_code on Payment Links, Checkout Sessions, or invoices.

Developer notes: Stripe Integration.

What creators share

Creators copy their Growi affiliate link from the campaign or ambassador dashboard. You do not generate those links on your site. If you prefer your own URL (for example yoursite.com/?ref=TAG), that works too: capture the tag and send it as campaign_affiliate_id on the sale.

Troubleshooting

We do not use Stripe. Can we still track sales?
Yes. Post each completed order to the Affiliate Sales endpoint with the creator's tag. That is all Growi needs.

Clicks work but sales do not show up
The link only sends the visitor to your site. A sale appears after you post it (or after Shopify or Stripe sends it). If you are on a custom checkout, confirm your server is calling Affiliate Sales after payment succeeds.

Shopify headless orders are not attributed
Confirm both scripts are in the shared layout and appear in View page source on a product page, not only the home page.

The API returns Campaign affiliate not found
campaign_affiliate_id must match an active creator tag on this brand. Tags are case-insensitive. Do not send the numeric campaign affiliate ID unless you are using growi_user_id and growi_campaign_id instead.

I am seeing duplicate sales
Reuse the same order_id on retries. Changing the order ID creates a second sale.

FAQs

What if we do not have Stripe?
You do not need it. Send each sale to Growi from your server after checkout. Stripe is only a shortcut for brands that already charge with Stripe.

Do we need to send an API request for every click?
No. Clicks are handled by the Growi link. Send an API request only when an order is completed.

Can we use this on WooCommerce or a fully custom site?
Yes. Capture the affiliate tag on arrival, then post the sale from your server after payment succeeds.

Does this work for iOS or Android apps?
Yes. Use the same Affiliate Sales endpoint with platform set to ios or android. The organization must have that app connected in Growi.

Where do I get an API key?
From your Growi brand account. Use it only on the server. If you cannot find it, ask us in live chat.

Have questions or want us to review your integration? Reach out anytime via live chat.

Did this answer your question?