How to add an affiliate program to your Base44 app
Create a program on Anderro, ask Base44's AI to add the tracking snippet to index.html, keep your secret key in Base44's Secrets, and have the AI pass the visitor ID in the backend function that creates your Stripe checkout.
Base44 steps last checked December 4, 2026.
Base44 at a glance
| Snippet | index.html, added by the AI chat (any plan) or by hand (paid plans) |
|---|---|
| Secret key | Dashboard › Secrets |
| Payments | Base44's Stripe setup (a backend function) |
| Plan needed | Any plan through the chat |
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 Base44's AI chat and ask it to put the script in index.html, inside <head>.
By hand (paid plans): Dashboard, then Code, then index.html. On the Free plan you can see the code but not change it, so use the chat.
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 Base44, open Dashboard, then Secrets, and add ANDERRO_SECRET_KEY, or ask the AI to set it with the secure secrets form. Backend functions read it as an environment variable.
Simplest: call anderro.track in the browser right after sign-up. Most reliable: a backend function sends the sign-up with your secret key and the visitor ID the browser sent.
// 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": Deno.env.get("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.
Base44 sets up Stripe from the AI chat and writes the checkout as a backend function. Ask the AI to set the visitor ID on the Checkout Session there, with the code below as a guide.
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. The snippet and any secret you changed reach your live app only after you do.
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 Base44
Paste this into Base44'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 Base44
- If your app's visitor tracking setting is Off, Base44 blocks tracking code you add yourself. Use "On" or "On after visitor consent".
- Base44 starts Stripe in a sandbox. Payments there are test payments and never earn a commission; live payments start once you claim the sandbox.
- Your app on
name.base44.appworks; 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
The snippet never runs
If your app's visitor tracking setting is Off, Base44 blocks tracking code you add yourself. Set it to On or On after visitor consent, then publish.
Payments show as test payments
Base44 starts Stripe in a sandbox. Live payments start once you claim the sandbox; sandbox payments never earn a commission.
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 Base44 have its own affiliate program?
Yes. Base44 pays a $100 commission for each referral who becomes a paid user within a month, with a 30-day cookie. That pays you for promoting Base44. 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.
Do I need a paid Base44 plan?
Not for the snippet: the AI chat can add it on any plan. Editing index.html by hand needs a paid plan.
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
Base44's menus and plans change; these are the pages we checked.
- Base44 docs: App analytics (custom scripts), checked December 4, 2026
- Base44 docs: Developer tools, checked December 4, 2026
- Base44 docs: Cookies and consent, checked December 4, 2026
- Base44 docs: Managing app secrets, checked December 4, 2026
- Base44 docs: Setting up payments, checked December 4, 2026
- Base44: Affiliate program, checked December 4, 2026
Base44 is a trademark of its owner. Anderro is not affiliated with or endorsed by them.