Squarespace's built-in code injection feature makes it simple to add tracking scripts across your entire website, ideal for SaaS companies using Squarespace for their marketing presence.
Add tracking script to your Squarespace site
Squarespace's recommended approach is to use the site-wide code injection settings, which applies the script to every page automatically.
-
Open your Squarespace site dashboard
-
Go to Settings → Developer Tools → Code Injection
-
In the 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
-
The script will automatically appear on all pages
Alternative: Use page-specific code injection by going to Pages → [Specific Page] → Settings → Advanced → Page Header Code Injection for targeted tracking.
For more details, see Squarespace's official code injection guide.
Testing
- Visit your Squarespace site with
?atp=test
- Check browser DevTools → Console → type
window.affonso_referral
- Verify the script appears in your page source
- Check tracking in your Affonso dashboard
Note: Code injection is available on Business plans and higher.
Multi-Domain Setup
If you're using Squarespace only for your marketing site (e.g., yourcompany.com
) and your SaaS 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 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 →