Install with an AI agent
Paste one prompt into Claude Code or Cursor and your coding agent adds OpenPromoter tracking to your app. It never touches your billing logic.
Your coding agent can do the whole install: the script tag, the signup call and the Stripe Checkout change.
Option 1: install the skill
npx -y openpromoter-cli skill
This writes .claude/skills/openpromoter/SKILL.md for Claude Code and .cursor/rules/openpromoter.mdc for Cursor into your project. Then ask: "add an affiliate program to my app with OpenPromoter". The skill tells the agent to:
- Add the op.js script tag to the root layout (with
data-consent="required"for EU sites that ask for consent). - Record signups in the browser with
window.openpromoter.signup({ email })or on the server withtrackSignupfrom the auth library's user-created hook (Better Auth, Auth.js, Clerk, Supabase). - Spread
stripeCheckoutParams(readReferralCookie(...))into everystripe.checkout.sessions.createcall and merge existing metadata. - Pass
op_clickas custom data for Paddle, Lemon Squeezy and Polar or report payments withop.conversions.createfor anything else. - Add
OPENPROMOTER_URL,OPENPROMOTER_API_KEYandOPENPROMOTER_PROGRAM_IDto the environment. Never change prices, plans or billing logic.
The skill source is in the repository at skills/openpromoter/SKILL.md.
Option 2: paste a prompt
Copy the prompt below, replace acme with your program slug and paste it into Claude Code, Cursor or any coding agent. The dashboard shows the same prompt with your slug filled in under Settings > Install.
The prompt
Add the OpenPromoter affiliate program to this app.
1. Add this script tag to the <head> of every marketing and app page:
<script async src="https://app.openpromoter.com/op.js" data-program="acme"></script>
2. When a user signs up, call window.openpromoter.signup({ email }) in the browser (it records the referral as a lead).
3. Wherever this app creates a Stripe Checkout Session, pass the visitor's click id:
client_reference_id: <value of window.openpromoter.clickId sent from the browser>
and subscription_data.metadata.op_click with the same value. If the app uses Stripe Payment Links or the Pricing Table, nothing else is needed: op.js adds client_reference_id automatically.
4. Do not change prices, plans or any other billing logic.
5. Afterwards, load the site once so OpenPromoter can verify the install.
Docs: https://openpromoter.com/docs/tracking
Self-hosters: replace https://app.openpromoter.com with your APP_URL.
What to check afterwards
- Open your site once. The setup wizard turns green when op.js loads.
- Visit your site through a partner link such as
https://yourapp.com/?via=<code>. - Sign up with a test email. The referral appears as a lead in the dashboard.
- Buy with Stripe in test mode. The commission appears as pending.
Using Paddle, Lemon Squeezy or Polar
Add this line to step 3 of the prompt:
Pass window.openpromoter.clickId as op_click in the checkout's custom data (Paddle customData, Lemon Squeezy checkout[custom][op_click], Polar checkout metadata).
Give your agent the API too
Install the MCP server so the same agent can check stats, invite partners and prepare payouts for you to approve.