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

  1. Visitor lands on example.com from Google Ads
  2. Pixel sets attribu_visitor_id cookie on example.com
  3. Visitor clicks "Sign up" which links to app.example.com
  4. Pixel appends ?_att_vid=xxx&_att_sid=yyy to the link
  5. app.example.com reads the params and sets matching cookies
  6. Visitor makes a purchase on app.example.com
  7. 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-hostnames or the data-domain will receive the visitor ID. Other outbound links are tracked as exit clicks but don't get the ID.
Copied