How to add an affiliate program to your Bolt app
Create a program on Anderro, paste one prompt into Bolt to add the tracking snippet, keep your secret key in Bolt's Secrets, and pass the visitor ID in the edge function that creates your Stripe checkout.
Bolt steps last checked December 4, 2026.
Bolt at a glance
| Snippet | index.html (Vite) or the root layout (Next.js), or let Bolt's chat add it |
|---|---|
| Secret key | Database icon › Secrets |
| Payments | Bolt's Stripe integration or your own Stripe account |
| Plan needed | Any; a custom domain needs a paid plan |
Set up in 5 steps
1. Create your program on Anderro
Sign up, add your product and choose what affiliates earn. Anderro then shows your tracking snippet with your public key filled in. It also gives you a secret key for your server.
The public key is safe in browser code. The secret key is not: keep it in your platform's secrets as ANDERRO_SECRET_KEY, never in the page or the chat.
2. Add the snippet
Easiest: paste the prompt Anderro gives you into Bolt's chat.
By hand: in index.html just before </head> (Vite apps), or in the root layout (Next.js apps).
By default the snippet waits for the visitor's consent before it sets its cookie. Call window.anderro.optIn() when they accept cookies. Your setup screen in Anderro tells you if your program is set to track without waiting.
<script src="https://track.anderro.com/a.js" data-key="YOUR_PUBLIC_KEY"></script>
3. Add your secret key and record sign-ups
In Bolt, open the database icon in the top menu, then Secrets, and add ANDERRO_SECRET_KEY. Only server functions can read it.
Simplest: call anderro.track right after sign-up. Bolt's database is Supabase, so with email confirmation on (the default) call it as soon as signUp succeeds. Most reliable: an edge function sends the sign-up with your secret key.
// right after the account is created
window.anderro?.track("signup", { email });
// on your server, after the account is created
await fetch("https://track.anderro.com/events", {
method: "POST",
headers: {
"content-type": "application/json",
"x-api-key": process.env.ANDERRO_SECRET_KEY,
},
body: JSON.stringify({
type: "signup",
customerEmail: email,
visitorId, // sent up by the browser from window.anderro?.getVisitorId()
}),
});
4. Connect Stripe and pass the visitor ID
In Anderro, open your product, choose Integrations, then Stripe, and copy your webhook URL. In Stripe, open Developers, then Webhooks, add an endpoint with that URL, select the seven events Anderro lists, and paste the endpoint's signing secret back into Anderro. Anderro keeps no access to your Stripe account.
Bolt's Stripe integration generates a checkout edge function: set the visitor ID on the Checkout Session there.
Stripe Payment Links: add the visitor ID to the link as client_reference_id.
// where your server creates the Stripe Checkout Session
const session = await stripe.checkout.sessions.create({
// ...your existing options
...(visitorId && {
client_reference_id: visitorId,
metadata: { anderro_vid: visitorId },
}),
});
// Stripe Payment Link: add the visitor id before sending the buyer on
const url = new URL("https://buy.stripe.com/your-link");
const vid = window.anderro?.getVisitorId();
if (vid) url.searchParams.set("client_reference_id", vid);
window.location.href = url.toString();
5. Publish and test
Publish again so the change reaches your .bolt.host address or custom domain.
Then open your site through your own test referral link from Anderro, sign up and buy. The click, the sign-up and the sale show on your Anderro dashboard. Stripe's test mode works too: test payments never earn a commission.
The prompt to paste into Bolt
Paste this into Bolt's AI chat. When you copy it from your setup screen in Anderro, your public key is already filled in. It tells the AI where every piece goes and never to handle your secret key.
# Task: add Anderro affiliate tracking to this app
Make the changes below, then list the files you changed.
## 1. Snippet: every page, inside <head>
<script src="https://track.anderro.com/a.js" data-key="YOUR_PUBLIC_KEY"></script>
- Replace YOUR_PUBLIC_KEY with my public key. It is safe in browser code.
- After the visitor accepts cookies, call window.anderro?.optIn().
## 2. Sign-ups: server side, on every sign-up path
- In the browser, read window.anderro?.getVisitorId() and send it with the sign-up request.
- After the account is created, call:
POST https://track.anderro.com/events
x-api-key: <value of the ANDERRO_SECRET_KEY environment variable>
{"type":"signup","customerEmail":"<email>","visitorId":"<visitor id>"}
## 3. Stripe checkout
- Where the server creates the Stripe Checkout Session, set client_reference_id and
metadata.anderro_vid to the visitor id the browser sent. Do not add other payment code:
Stripe reports payments to Anderro itself.
## 4. Secret key: I add it myself, you never see it
- Read it only on the server, only from the environment variable ANDERRO_SECRET_KEY.
- Do not ask me to paste the key into this chat. Do not print, log or write it to any file.
- If the variable is not set, stop and tell me to add it in this platform's secrets.
- Never use it in browser code.
How a sale is tied to an affiliate
The snippet remembers which affiliate sent a visitor and gives that visitor an ID. Your checkout passes the ID to Stripe, Stripe sends the sale to Anderro, and the affiliate who sent the customer is credited. Renewals need no extra code: they are matched to the customer from their first payment.
A customer who already bought through one affiliate stays with that affiliate, and an affiliate buying through their own link earns nothing unless you allow it.
What to know on Bolt
- Your app on
name.bolt.hostworks; Anderro asks once whether that address is your real site or a preview. - US dollars only. A payment in another currency is not recorded, and Anderro's Integrations page tells you when one arrives.
- Commissions wait out a hold you choose (7 to 90 days), so a refund inside the hold never costs you a commission.
If something does not show up
I cannot find Secrets
Secrets sit under the database icon, which appears once the project has a database. Only owners, co-owners and admins can open it.
Sign-ups are missing when email confirmation is on
Supabase returns no session until the email is confirmed. Call anderro.track as soon as signUp succeeds, not after the first login.
My test click does not show up
The snippet waits for consent: accept cookies on your site, and check that your cookie banner calls window.anderro.optIn(). If your site sets a Content Security Policy, allow https://track.anderro.com in script-src and connect-src.
A sale shows up, but no affiliate is credited
The visitor ID did not reach the checkout. Open the payment in your billing dashboard and check it carries the ID, and buy in the same browser you opened the referral link in.
Questions
Does Bolt have its own affiliate program?
Bolt runs a referral program rather than an affiliate program: you earn 15% of a referred subscriber's payments for their first three months, up to $50 per referral, and they get 20% off. That pays you for promoting Bolt. This guide is the other way round: running an affiliate program for an app you built. Looking for more software to promote? Browse SaaS affiliate programs on Anderro.
Where does the sign-up call go in a Bolt app?
Right after the account is created. In most Bolt apps that is the function that calls Supabase's signUp. Ask Bolt to add it there with the prompt Anderro gives you.
Does Anderro pay my affiliates?
No. Anderro tracks clicks, sign-ups and sales and works out what each affiliate earned. You pay affiliates yourself and mark the payout paid in Anderro.
Do my affiliates need an account on this platform?
No. They join your program on Anderro and get their link there. Their link is your site's address ending in ?ref= and their code.
Sources
Bolt's menus and plans change; these are the pages we checked.
- Bolt support: Secrets, checked December 4, 2026
- Bolt support: Getting started (bolt.host), checked December 4, 2026
- Bolt: Referral program, checked December 4, 2026
Bolt is a trademark of its owner. Anderro is not affiliated with or endorsed by them.