Wix provides custom code injection capabilities that make it easy to add tracking scripts to your entire website, perfect for SaaS companies using Wix for their marketing presence.
Add tracking script to your Wix site
Wix's recommended approach is to use the site-wide custom code settings through the Wix Editor, ensuring the script loads on all pages of your website.
-
Open your Wix site in the Wix Editor
-
Click Settings in the top menu
-
Go to Custom Code in the settings menu
-
Click + Add Custom Code
-
Set the code to load in All Pages and place in 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 Apply
-
Publish your site for the changes to take effect
Alternative: Add the script to specific pages only by selecting individual pages instead of "All Pages".
For more details, see Wix's official custom code guide.
Testing
- Publish your Wix site after adding the custom code
- Visit your published site with
?atp=test
- Check browser DevTools → Console → type
window.affonso_referral
- Verify tracking in your Affonso dashboard
Note: Custom code requires a Wix Premium plan and only works on the published site, not in the editor preview.
Multi-Domain Setup
If you're using Wix only for your marketing site (e.g., yourcompany.com
) and your application 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 yourcompany.com
and app.yourcompany.com
. 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 →