Cross-domain tracking
If your marketing site and app/checkout live on different domains, you need cross-domain tracking to maintain the visitor identity across them.
How it works
When a visitor clicks a link from one of your domains to another, the pixel appends the visitor and session IDs as URL parameters (_att_vid and _att_sid). The receiving domain picks them up and sets matching cookies.
Setup
1. Set the root domain
The data-domain attribute on your script tag should be set to your primary domain:
<script
defer
data-website-id="YOUR_SITE_ID"
data-domain="example.com"
src="https://attribu.tech/js/script.js"
></script>2. Add allowed hostnames
List all your additional domains in Settings > General > Additional Domains. Or use thedata-allowed-hostnames attribute:
<script
defer
data-website-id="YOUR_SITE_ID"
data-domain="example.com"
data-allowed-hostnames="app.example.com,shop.example.com"
src="https://attribu.tech/js/script.js"
></script>3. Install the pixel on all domains
Use the same data-website-id on all domains. The visitor ID will be shared via URL parameters when clicking between them.
The URL parameters (
_att_vid, _att_sid) are automatically cleaned from the URL after being read, so they won't appear in your analytics or confuse users.Example flow
- Visitor lands on
example.comfrom Google Ads - Pixel sets
attribu_visitor_idcookie onexample.com - Visitor clicks "Sign up" which links to
app.example.com - Pixel appends
?_att_vid=xxx&_att_sid=yyyto the link app.example.comreads the params and sets matching cookies- Visitor makes a purchase on
app.example.com - Payment attributed back to Google Ads (first touch on
example.com)
Limitations
- Cross-domain only works for links clicked by the user. It does not work for direct navigation, redirects, or bookmark visits.
- The visitor must have JavaScript enabled on both domains.
- Only domains listed in
data-allowed-hostnamesor thedata-domainwill receive the visitor ID. Other outbound links are tracked as exit clicks but don't get the ID.