Unbounce's JavaScript management feature allows you to add custom tracking scripts to your landing pages, perfect for SaaS companies using Unbounce for high-converting marketing campaigns.
Add tracking script to your Unbounce page
Unbounce's recommended approach is to use the JavaScript section in the page editor, which ensures the script loads properly with Unbounce's optimized page loading system.
-
Open your landing page in the Unbounce Builder
-
Click on Javascripts in the sidebar (or Page Properties → Javascripts)
-
Click Add Javascript
-
Set the placement to Head
-
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
- Publish your landing page
Alternative: Use the "Before Body End Tag" placement if you prefer the script to load after page content, or add it at the domain level for multiple pages.
For more details, see Unbounce's official JavaScript guide.
Testing
- Publish your Unbounce landing page
- Visit your published page with
?atp=test
- Check browser DevTools → Console → type
window.affonso_referral
- Verify tracking in your Affonso dashboard
Note: Changes to JavaScript require republishing the page to take effect.
Multi-Domain Setup
If you're using Unbounce for landing pages (e.g., campaign.yourcompany.com
) while your main application runs elsewhere (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 →