Skip to content

Install

Install with an AI assistant

Copy a ready-made prompt from setup into the AI that builds your site, so it adds the website tag and the payment code for you. The prompts, and how to check the result.

How it works

EzyPromote needs two small changes on your side: a script tag on every page of your website, and, for some checkouts, a few lines of code where payments start. If an AI tool builds or edits your site, it can make both changes for you.

Setup gives you a ready-made prompt for each change. The prompt holds your own values, such as your website tag, says exactly what to change and what to leave alone, and asks the AI to list the files it changed. You paste it, review the change, and publish.

It works with any AI that can edit your site’s code: Claude Code, Cursor, Lovable, Bolt, v0, Replit, Windsurf, GitHub Copilot and others. With a chat-only AI, such as ChatGPT or Claude in the browser, paste the prompt along with the file it asks about, then copy the change back yourself.

On Webflow, Wix, Squarespace or Framer, where you can’t edit the code, paste the tag yourself instead. It takes a minute: see Add the website tag.

1. Install tracking

  1. In Setup, go to step 2, Install tracking. With an AI assistant is open.
  2. Choose Copy prompt.
  3. Paste it into your AI tool and let it make the change.
  4. Check what it changed. It should add one <script> tag inside <head>, in a shared layout or template, exactly as copied. See “Check the AI’s work” below.
  5. Publish your site, then choose Check my site in EzyPromote.

Your developer can record clicks on your server instead, or as well: see Track clicks and signups on your server.

The prompt looks like this. Setup fills in your own tag, and the security policy addresses from it:

Install EzyPromote affiliate tracking on my website.

EzyPromote records visits that arrive through affiliate links (links ending in ?via=<code>), so it can credit the affiliate when that visitor pays. It needs one script tag on every page of the site.

1. Find where the site renders the <head> of every page: the root layout, the base template, the theme header, or the site builder's "custom code in head" setting. If pages use different layouts, add the tag to each one.
2. Add this tag inside <head>, exactly as written:

<YOUR WEBSITE TAG>

Rules:
- Keep every attribute and value as it is. Don't change the keys or the integrity hash, don't remove crossorigin, and don't add defer or type="module".
- Load it as a plain script tag. Don't bundle it, import it, or download a copy.
- Next.js App Router: app/layout.tsx inside <head>, written as crossOrigin in JSX. Pages Router: pages/_document.tsx inside <Head>.
- Astro: add is:inline to the script tag.
- React, Vue or Svelte single-page apps: index.html.
- WordPress: the theme's header.php before </head>, or a header-code plugin such as WPCode.
- Google Tag Manager: a Custom HTML tag that fires on All Pages.
- If the site sends a Content-Security-Policy, allow https://api.ezypromote.com in script-src and https://api.ezypromote.com in connect-src.
- Don't add any other EzyPromote code. The tag finds affiliate visits on its own.

When you're done, list the files you changed. I'll publish the site and choose "Check my site" in EzyPromote.

Full guide: https://ezypromote.com/docs/install-website-tag

2. Match payments

Once payments are connected, setup step 3 asks How your customers pay. Stripe payment links and pricing tables need no code, so there is no prompt for them. Every other way has a prompt under With an AI assistant, and the code itself under Write it myself. Match payments to affiliates explains which way fits your checkout.

The code in these prompts is an example of the change, not code to paste as it is. Your checkout and signup code will look different, and the AI adapts the change to it. The same goes for the code under Write it myself: use it as a guide to where the values go.

  1. In Setup, go to step 3, Connect payments, and pick how your customers pay.
  2. Under With an AI assistant, choose Copy prompt and paste it into your AI tool.
  3. Add any secret it asks for yourself, in your hosting provider’s environment variables. Never paste a secret key into the AI chat.
  4. Deploy, then run a test purchase in step 4. See Test a purchase and go live.

Stripe Checkout started by your code

Connect my Stripe Checkout to EzyPromote affiliate tracking.

The EzyPromote tag is installed on my site. When a visitor came from an affiliate link, EzyPromote needs that visit's click token on the Stripe Checkout Session, so the payment is credited to the right affiliate.

1. Install the EzyPromote Node SDK: npm install <THE SDK ADDRESS SETUP SHOWS>
2. Find every place the server creates a Stripe Checkout Session (stripe.checkout.sessions.create).
3. Read the click token from the incoming request and add it to the session's metadata as ep_click, next to any metadata already there:

import { checkoutClickToken } from '@ezypromote/node/referrals'

// Where the server creates the Checkout Session:
const epClick = checkoutClickToken(request) // the incoming request; null when no affiliate sent the visitor
const metadata = epClick ? { ep_click: epClick } : {}
const session = await stripe.checkout.sessions.create({ /* your existing options */ metadata })

4. In subscription mode, pass the same metadata as subscription_data.metadata too. Don't add subscription_data in payment mode: Stripe refuses it.
5. If the code creates Stripe customers itself (stripe.customers.create), put the same metadata on the customer.
6. Backend not in JavaScript? Add the data-ep-signup attribute to the form that starts checkout. The server then receives a field named ep_click: put its value in the session's metadata as ep_click.

When you're done, list the files you changed. I'll check it with a test purchase in EzyPromote.

Full guide: https://ezypromote.com/docs/match-payments

Sign up first, pay later

This one needs a secret key. Create one in Settings → Tracking and payments, under Signups, or in Settings → Developers, under API keys: sk_test_… while you test, sk_live_… for your live site. Add it to your server as EZYPROMOTE_SECRET_KEY.

Tell EzyPromote about each new signup, so a customer who pays later is credited to the affiliate who sent them.

1. Install the EzyPromote Node SDK: npm install <THE SDK ADDRESS SETUP SHOWS>
2. Read the secret key from an environment variable named EZYPROMOTE_SECRET_KEY. I'll add the value myself: it's a secret key from EzyPromote's Settings → Developers page (sk_test_… while testing, sk_live_… in production). Never put it in browser code or commit it.
3. Right after the code creates a user record, call:

import { EzyPromote, referralContext } from '@ezypromote/node/referrals'

const ezypromote = new EzyPromote(process.env.EZYPROMOTE_SECRET_KEY)

// Right after the code creates the user record:
await ezypromote.referrals.create({
  externalUserId: user.id, // the user's id in my app
  email: user.email,
  clickTokens: referralContext(request), // the incoming request
})

4. Don't block or fail the signup on the result: the call never throws, and waits 8 seconds at most.
5. Payments in Stripe: put the same user id in Stripe as metadata ep_user_id, on the Customer (stripe.customers.create) or the Checkout Session, so later payments follow the user. Payments in another billing system: send it as user_id.

When you're done, list the files you changed. I'll check it with a test purchase in EzyPromote.

Full guide: https://ezypromote.com/docs/match-payments

Another billing system

Connecting test mode gives you an endpoint and a signing secret. Add them to your server as EZYPROMOTE_BILLING_ENDPOINT and EZYPROMOTE_BILLING_SECRET. See Use another billing system for every event and field.

Send my billing system's payments to EzyPromote, so affiliates are credited.

Read two values from environment variables: EZYPROMOTE_BILLING_ENDPOINT (the endpoint URL) and EZYPROMOTE_BILLING_SECRET (the signing secret). I'll add the values myself from EzyPromote. Never commit them.

1. For every successful charge, including renewals, POST a transaction.paid event to the endpoint. For refunds send transaction.refunded, for disputes dispute.updated, and for cancellations subscription.canceled.
2. Body: {"id": "<your unique event id>", "type": "transaction.paid", "created": <unix seconds>, "livemode": <false for test payments, true for live>, "data": {"transaction_id": "...", "kind": "subscription_initial" | "subscription_renewal" | "subscription_change" | "one_time", "currency": "USD", "amount_paid": <integer cents, tax included>, "paid_at": <unix seconds>, "user_id": "...", "customer_id": "...", "email": "...", "referral_hint": "<the visitor's ep_click value>"}}
3. Sign every request with the header EzyPromote-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of t + "." + the raw body, keyed with the secret>. Serialise the JSON once, sign that string, and send that same string with Content-Type: application/json.
4. Find the affiliate: the EzyPromote tag adds an ep_click field to signup forms. Store it with the user, and send it as referral_hint. Also send user_id and customer_id when you have them.
5. Use the same id when retrying an event: it's the idempotency key. Retry network errors, 429 and 5xx answers with a fresh signature.

When you're done, list the files you changed. I'll check it with a test purchase in EzyPromote.

Full guide: https://ezypromote.com/docs/custom-billing-api

Check the AI’s work

AI tools are good at this change, and they sometimes “improve” what they were told to leave alone. Before you publish, check:

  • The tag is exactly as copied. Same src, integrity, crossorigin, data-key and data-test-key. A browser refuses to run the tag if src, integrity or crossorigin change. If the AI reformatted it, paste the tag again yourself.
  • It’s in a shared place. A root layout, base template or theme header covers every page at once. A tag on one page only records visits to that page.
  • No copies of the script. The AI shouldn’t download ep.js, import it, or bundle it.
  • No secrets in the code. Secret keys and signing secrets belong in environment variables, never in a file the browser loads or in your repository.

Then let EzyPromote check it: Check my site for the tag, and a test purchase for payments.

When it doesn’t work

  • “Tag not found” after publishing. Ask the AI where it added the tag and whether that layout renders on your home page. Then check that the site was published.
  • “Your browser will refuse to run the tag”. The tag was changed. Copy it again and ask the AI to replace it exactly.
  • The test purchase found no affiliate. Ask the AI to show where ep_click is added to the Checkout Session, or where the signup is sent. Compare it with the code under Write it myself in setup.
  • The AI can’t edit your site. Paste the tag yourself: see Add the website tag.

Next: Connect Stripe, or Add the website tag for platform-by-platform steps.