Bubble's no-code platform allows custom JavaScript integration through HTML elements and SEO settings, making it perfect for adding affiliate tracking to your SaaS application.
Add tracking script to your Bubble app
The recommended approach is to use Bubble's SEO/meta tags settings to add the script globally across all pages of your application.
-
Open your Bubble editor
-
Go to Settings → SEO/Metatags
-
In the Script/meta tags in header section, add your tracking script:
<script async defer src="https://affonso.io/js/pixel.min.js" data-affonso="YOUR_PUBLIC_PROGRAM_ID" data-cookie_duration="YOUR_COOKIE_DURATION" ></script>
-
Click Save
-
Deploy your app for the changes to take effect
Alternative: Add an HTML element to specific pages and paste the script code for page-specific tracking.
For more details, see Bubble's guide.
Testing
- Deploy your Bubble app after adding the script
- Visit your live app with
?atp=test
- Check browser DevTools → Console → type
window.affonso_referral
- Verify tracking in your Affonso dashboard
Note: Custom scripts only work on the live/deployed version, not in Bubble's preview mode.
Multi-Domain Setup
If you're using Bubble for your complete SaaS application, the tracking script will handle everything in one place. However, if you have a separate marketing site (e.g., yourcompany.com
) while your Bubble app runs on a subdomain (e.g., app.yourcompany.com
), make sure to install the Affonso tracking script on both domains.
Affonso works seamlessly across subdomains - the same affiliate cookie will be shared between domains. See our multi-domain setup guide for more details on cross-domain tracking.
Next Steps
Once installed, you can access affiliate referral data and pass it to your payment provider. Connect your payment provider →