Cross-domain tracking enables Google Analyticsto track visitors as consecutive sessions on two or more related websites. For example, when tracking www.sitea.com and www.siteb.com in the same GA Web property.
How does it work and what does it do?
Google Analytics uses a first-party cookie called _ga. For our example, this means that 1 cookie is used for www.sitea.com, apps.sitea.com, blog.sitea.com and other subdomains. This is easily done by setting the cookie domain setting in GTM to automatic.
This _ga cookie stores information about the visitor and his session and has the following properties:
Cookie name - by default "_ga".
Cookie domain - this is the domain where the cookie is set. For www.sitea.com it means that the cookie domain is '.sitea.com'. (without the "www" prefix)
Cookie path - this is the path where the cookie will be stored. This is the root directory of the "/" domain.
Cookie Expires - This is the time in seconds after which the _ga cookie will expire. By default, the _ga cookie expires after 2 years from the time of the last update.
Since it is a first-party cookie, it cannot share this information with other domains. This is where cross domain tracking comes into play. In this case, we need to instruct it to pass the values of the Cookies from sitea.com with the cookie from siteb.com.
This sends the cookie value _ga to the URL appended to the domain change, using the query string by default. If you don't like the query string, you can also change it to a URL-fragment. GA recognizes the parameters added in these URLs and ensures that the GA cookie uses these values.
What are subdomains?
Often the Cross-domain tracking confused with subdomain tracking. A subdomain is basically a subdivision of a domain which, if used properly, helps to divide different sections of the website. In short, we can explain it with this structure: https://subdomain.domain.co.uk.
What if we do not do this?
It has a great impact on what people do on your website. The wrong distribution of traffic sources has increased the number of sessions. It's impossible to judge which marketing channels are more successful than others in generating valuable Traffic to generate. The list goes on. In short, there is no way to make decisions based on the data collected in Google Analytics.
Of course, there are also some scenarios where cross-domain tracking cannot be performed, mainly because GA cannot be implemented on those domains. One such scenario applies to payment gateways (for those that have transactional websites). In this case, you need to use the GA exclusion list, which can be accessed from the GA admin panel.« Back to Glossary Index