How to add an affiliate program to your Bubble app
Create a program on Anderro, paste the tracking snippet into Bubble's header settings, record sign-ups with an HTML element, and sell through Stripe Payment Links tagged with the visitor ID.
Bubble steps last checked December 4, 2026.
Bubble at a glance
| Snippet | Settings › SEO / metatags › Script/meta tags in header |
|---|---|
| Secret key | Not needed for Payment Links; API Connector private key if you call the API |
| Payments | Stripe Payment Links (the Stripe plugin cannot pass the visitor ID) |
| Plan needed | One that deploys to Live (Starter or above) |
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 to the header
In Bubble, open Settings, then SEO / metatags, and paste the snippet into "Script/meta tags in header". It runs on every page.
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. Record sign-ups
Add an HTML element to the page users see once, right after they sign up (not to every page), with the script below. Replace the email with Bubble's dynamic data: Current User's email.
<script>
window.anderro?.track("signup", { email: "Current User's email" });
</script>
4. Connect Stripe and tag your Payment Links
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.
Point your buy buttons at Stripe Payment Links, then add the script below next to the snippet (in the same "Script/meta tags in header" box. Use Link elements that point at the Payment Link, since the script tags links, not workflow actions). When a buyer clicks, it adds their visitor ID to the link as client_reference_id, and Stripe hands it back with the sale.
If your Payment Links use your own domain instead of buy.stripe.com, change the address in the script to match.
<script>
// Adds the Anderro visitor ID to Stripe Payment Links when they are clicked.
document.addEventListener("click", function (e) {
var a = e.target.closest && e.target.closest('a[href^="https://buy.stripe.com/"]');
var vid = window.anderro && window.anderro.getVisitorId && window.anderro.getVisitorId();
if (!a || !vid) return;
var url = new URL(a.href);
url.searchParams.set("client_reference_id", vid);
a.href = url.toString();
}, true);
</script>
5. Publish and test
Deploy to Live. Your version-test app has its own database, so test on the live version.
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.
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 Bubble
- Bubble's official Stripe plugin has no field for the visitor ID, so sales made through it cannot be credited to an affiliate. Use Payment Links as above, or create Checkout Sessions with the API Connector and set
client_reference_id. - If you send events from a backend workflow with the API Connector, set the collection's authentication to "Private key in header" with the key name
x-api-key. With "None or self-handled", Bubble can expose private values. - 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
Clicking Buy does not add the visitor ID
The click script tags links. A workflow's Open an external website action is not a link, so point a Link element at the Payment Link instead.
Everything works in version-test but not live
version-test has its own database and settings. Deploy to Live and test there.
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
Which Bubble plan do I need?
A plan that lets you deploy to a live site (Starter or above). The free plan only runs the development version.
Can I use Bubble's Stripe plugin?
Not for affiliate sales. None of its actions has a field for the visitor ID, so Stripe cannot hand it back with the sale. Use Payment Links with the click script, or create Checkout Sessions with the API Connector and set client_reference_id.
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
Bubble's menus and plans change; these are the pages we checked.
- Bubble manual: SEO / metatags settings, checked December 4, 2026
- Bubble manual: The API Connector, checked December 4, 2026
- Bubble manual: API Connector authentication, checked December 4, 2026
- Bubble manual: Stripe plugin, checked December 4, 2026
- Bubble pricing, checked December 4, 2026
- Stripe docs: Payment Links URL parameters, checked December 4, 2026
Bubble and Stripe are trademarks of their owners. Anderro is not affiliated with or endorsed by them.