About cross-domain tracking

30/11/2019

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.

Two views used to collect data from two separate websites

Cross-domain tracking behavior

Suppose you have an online store and a 3rd-party shopping cart hosted on another domain, such as:

  1. www.example-petstore.com
  2. www.example-commerce-host.com/example-petstore/

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.

 

One view used to collect data from two separate websites

Related Resources

analytics.js

gtag.js

* Nguồn: Google Analytics