/bubble-tutorials

How to build an affiliate marketing system in Bubble

Learn how to build a streamlined affiliate marketing system in Bubble with step‑by‑step guidance to boost referrals, track commissions, and grow revenue.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web or mobile app? RapidDev builds Bubble apps with your growth in mind.

Book a Free Consultation

How to build an affiliate marketing system in Bubble

To build an affiliate marketing system in Bubble, you store a unique referral ID for each User, generate a referral link using that ID, track visits and sign‑ups through that link, and reward the affiliate when the referred User performs a qualifying action (for example, a purchase). Bubble’s database, URL parameters, backend workflows, and privacy rules make this straightforward without plugins.

 

Core Structure

 

The system works by giving each User a field such as referral\_code, sending people to a page with ?ref=XYZ in the URL, saving that code when a new visitor signs up, and later checking that relationship when awarding commissions.

  • User fields: referral_code (text), referred_by (User), affiliate\_balance (number).
  • Optional type: Referral (stores clicks or sign‑ups).
  • Where Bubble helps: Get data from page URL, backend workflows, Make changes to a thing, privacy rules.

 

Step‑by‑Step Setup

 

Create the field referral\_code on User. When a User signs up, run a workflow to set it to something unique like Current User's unique id or a short random string generated with Bubble’s Calculate formula → Generate random string.

  • On any public landing page: read the URL parameter ref using “Get data from page URL”. Store it temporarily in a state or in a cookie‑like thing using a field on a datatype called “PendingReferral”.
  • When the visitor signs up: if the URL has ref, set Current User's referred_by to “Do a search for User where referral_code = ref”.
  • If you track clicks: create a Referral thing whenever someone loads the page with the ref code.

 

Rewarding the Affiliate

 

If a referred User makes a purchase, run a backend workflow triggered by the payment event (Stripe webhook or Bubble workflow). Check if the buyer’s referred\_by is not empty, then credit them:

// Backend workflow: reward affiliate
Make changes to thing: User = This User's referred_by
Field to change: affiliate_balance = This User's referred_by's affiliate_balance + 10 // example reward

 

Essential Privacy Rules

 

In the User privacy tab, allow a User to see only their own affiliate data. For example:

  • When Current User is This User → view fields (referral_code, affiliate_balance).
  • Otherwise deny access.

 

Creating the Affiliate Link

 

Your affiliate dashboard button might simply display:

// Build a shareable link
https://yourapp.com?ref=Current User's referral_code

 

This gives every User a safe, working affiliate system built entirely with Bubble’s native tools.

Explore More Valuable No-Code Resources

How to integrate Bubble.io with Git?

Learn how to seamlessly integrate Bubble.io with Git through our comprehensive step-by-step guide. Perfect for beginners and professionals.

Explore

How to integrate Bubble.io with Reddit Ads?

Learn how to seamlessly integrate Bubble.io with Reddit Ads using our easy step-by-step guide. Boost your ad management today!

Explore

How to integrate Bubble.io with AWS S3?

Explore our step-by-step guide on integrating Bubble.io with AWS S3, making your app development process more efficient and secure.

Explore

How to integrate Bubble.io with Lucidchart?

Follow our step-by-step guide to seamlessly integrate Bubble.io with Lucidchart, enhancing your workflow & productivity.

Explore

How to integrate Bubble.io with Kentico?

Learn how to seamlessly integrate Bubble.io and Kentico with our comprehensive, easy to follow step-by-step guide.

Explore

How to integrate Bubble.io with Box?

Discover easy-to-follow steps for integrating Bubble.io with Box. Boost your workflow and secure your files seamlessly today.

Explore

Stuck in Bubble.io? We’re here to help!

Fix broken workflows | Optimize logic | Boost performance | Scale with confidence

4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members

By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.

Cookie preferences