Building an affiliate marketing platform in Bubble involves creating Affiliate, AffiliateLink, Click, and Conversion data types with tracking workflows that attribute sales to affiliates via unique links. This tutorial covers affiliate signup, link generation with UTM parameters, click and conversion tracking, commission calculation tiers, and a payout management dashboard.
Overview: Building an Affiliate Marketing Platform in Bubble
This tutorial guides you through building a complete affiliate marketing platform where affiliates sign up, generate unique tracking links, earn commissions on sales they drive, and get paid through a managed payout system.
Prerequisites
- A Bubble app with products or services to promote
- User authentication and payment processing set up
- API Connector plugin for webhook handling
- Understanding of URL parameters and backend workflows
Step-by-step guide
Create the affiliate data model
Create the affiliate data model
Go to the Data tab and create: Affiliate (user, status, commission_rate, total_earned, total_paid, payment_info). AffiliateLink (affiliate, target_url, tracking_code, click_count, conversion_count). Click (link, ip_address, referrer, user_agent, clicked_at). Conversion (link, affiliate, order_amount, commission_amount, status, converted_at). Payout (affiliate, amount, status, period_start, period_end, paid_at).
Expected result: Complete data model for tracking affiliate activity and payouts.
Build affiliate signup and approval flow
Build affiliate signup and approval flow
Create a signup page where users apply to become affiliates. Collect: name, website, promotional methods, payment info. Create an Affiliate record with status=Pending. Build an admin page to review and approve/reject applications. On approval, set status=Active and send a welcome email with dashboard access.
Expected result: Users can apply to be affiliates and admins approve applications.
Implement link generation and click tracking
Implement link generation and click tracking
On the affiliate dashboard, add a Link Generator section. The affiliate enters a target URL, and a workflow generates a unique tracking_code and creates an AffiliateLink. The tracked URL format is yourapp.com/track?code=XXXXX&url=TARGET. Create a page called track that reads the code parameter, creates a Click record with IP and timestamp, increments the link's click_count, and redirects to the target URL. Use a backend workflow for the redirect to avoid exposing tracking logic.
Pro tip: For reliable click tracking and attribution across complex funnels, RapidDev can help build enterprise-grade affiliate tracking systems.
Expected result: Affiliate links track clicks and redirect to the target URL.
Set up conversion tracking and commission calculation
Set up conversion tracking and commission calculation
When a sale occurs in your app, check if the buyer came through an affiliate link (check URL parameters or cookies). Create a Conversion record linking the sale to the AffiliateLink and Affiliate. Calculate the commission: order_amount * affiliate's commission_rate. Increment the link's conversion_count and the affiliate's total_earned. Use tiered rates: 10% for first $1000, 15% for $1000-5000, 20% above $5000.
Expected result: Sales from affiliate links are tracked and commissions calculated automatically.
Build the payout management system
Build the payout management system
Create a backend workflow that runs monthly. For each active affiliate, calculate total commissions earned minus total paid. If the balance exceeds a minimum threshold ($50), create a Payout record with status=Pending. Build an admin payout page showing pending payouts. When an admin clicks Pay, process the payment (manual or via Stripe Connect) and update the Payout status and Affiliate's total_paid.
Expected result: Monthly payouts are calculated and managed through an admin interface.
Complete working example
1AFFILIATE PLATFORM WORKFLOW SUMMARY2=====================================34DATA TYPES:5 Affiliate: user, status, commission_rate, total_earned, total_paid6 AffiliateLink: affiliate, target_url, tracking_code, click_count, conversion_count7 Click: link, ip, user_agent, clicked_at8 Conversion: link, affiliate, order_amount, commission_amount, status9 Payout: affiliate, amount, status, period, paid_at1011FLOWS:12 1. Apply → Create Affiliate (Pending)13 2. Admin Approve → Set Active, send welcome14 3. Generate Link → Create AffiliateLink with unique code15 4. Track Click → /track page creates Click, redirects16 5. Track Conversion → On sale, create Conversion, calc commission17 6. Monthly Payout → Backend calculates balances, creates Payouts18 7. Admin Pay → Process payment, update totalsCommon mistakes when building an affiliate marketing platform in Bubble.io: Step-by-Step Guide
Why it's a problem: Not deduplicating clicks from the same IP
How to avoid: Check for existing clicks from the same IP within the last 24 hours before counting as new.
Why it's a problem: Calculating commissions on gross instead of net amounts
How to avoid: Calculate commissions on the net order amount after discounts and deduct commissions for refunded orders.
Why it's a problem: Not setting a minimum payout threshold
How to avoid: Set a minimum payout threshold ($50-$100) and only create payout records when the balance exceeds it.
Best practices
- Deduplicate clicks by IP within a time window
- Calculate commissions on net amounts after discounts and refunds
- Set minimum payout thresholds to reduce processing costs
- Use tiered commission rates to incentivize higher-performing affiliates
- Track conversion rates (conversions/clicks) for each affiliate and link
- Provide real-time dashboards so affiliates can monitor their performance
- Run monthly payout calculations via scheduled backend workflows
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to build an affiliate marketing platform in Bubble.io with affiliate signup, unique tracking links, click and conversion tracking, tiered commissions, and monthly payouts. Can you design the data model and key workflows?
Build an affiliate platform for my app. I need affiliate applications with admin approval, link generation with click tracking, conversion attribution, tiered commission calculation, and a monthly payout system.
Frequently asked questions
How do I prevent affiliate fraud?
Monitor click-to-conversion ratios. Flag affiliates with unusually high clicks but low conversions. Check for click farms by analyzing IP patterns and user agents.
Can I offer different commission rates to different affiliates?
Yes. The commission_rate field is per-affiliate. Set different rates based on performance tier, partnership level, or negotiated agreements.
How do I handle refunds?
Create a workflow that fires when an order is refunded. Find the associated Conversion, set its status to Refunded, and deduct the commission from the affiliate's total_earned.
Can affiliates see their performance in real time?
Yes. Build an affiliate dashboard showing clicks, conversions, conversion rate, earnings, and pending payouts using searches on the affiliate's data.
What payment methods can I use for payouts?
Stripe Connect for automated payouts, PayPal via API, or manual bank transfers. Track all payouts in the Payout data type regardless of method.
Can RapidDev help build enterprise affiliate systems?
Yes. RapidDev can build advanced affiliate platforms with multi-tier commissions, real-time tracking, fraud detection, and automated payout processing.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation