About cross-domain tracking
Cross-domain tracking makes it possible for Analytics to see sessions on two related sites (such as an ecommerce site and a separate shopping cart site) as a single session. This is sometimes called site linking.In this article:
Standard tracking code behavior
The standard Analytics tracking code records traffic to a given URL as a group. For example, if you set up tracking to your blog—myexampleblog.example.com—traffic to all pages and subdirectories to your site is collected and tallied as a unit. That way, when a user goes from one page on your site to another page on that same site, Analytics reports show the following relationships:
- navigation path between pages
- total time on site—as a cumulation of time on pages
- number of individual sessions and unique sessions
- number of unique users
In addition, Analytics treats traffic to separate URLs as unique and unrelated (except for referring links). This is how you would expect Analytics to work, since you would not want data from one website to appear in the Analytics report for a separate, unrelated website.
Cross-domain tracking behavior
Suppose you have an online store and a 3rd-party shopping cart hosted on another domain, such as:
Without cross-domain tracking, a user who arrives to your online store and then proceeds to your 3rd-party shopping cart is counted as two separate users, with two separate sessions of different durations.
Cross domain tracking makes it possible for Analytics to see this as a single session by a single user. This is sometimes called site linking. A user to your online store who proceeds to your shopping cart is counted as one user, instead of two users, and the session they started on the store site is continued through to the time spent on the shopping cart site.
- Cross-Domain Tracking - Web Tracking (analytics.js developer documentation)
- Cross-domain tracking with Google Tag Manager