Measure customer journeys across domains

The domain linker functionality enables two or more related sites on separate domains to be measured as one. The gtag.js framework provides a common way for supported Google products to measure activity when your customer journeys span across multiple domains.

The domain linker shares 1st party measurement cookies between a source domain and a destination domain. The 1st party measurement cookies are stored in a web browser, and can only be accessed by pages on the same domain.

Setup for cross-domain measurement is a two-step process:

  1. The source domain decorates URLs that point to the destination domain so that they contain the 1st party measurement cookie values of the source domain.
  2. The destination domain checks for the presence of linked measurement cookies.

Cross-domain measurement with gtag.js adds a linker parameter to URLs that point to the destination domain. The linker parameter is identified in URL query parameters with the key _gl:

On the destination domain, gtag.js is configured to check for linker parameters in the URL. If a valid linker parameter is found, gtag.js extracts the 1st party measurement cookie and stores it.

Basic setup

To set up cross-domain measurement on the source domain for URLs that point to the destination domain, use the set command to create a linker object. The linker will listen for clicks on links that point to destination domains, and it will automatically add a linker parameter to the URLs of those links.

The linker object requires a domains parameter, which is an array of one or more domains. This code will append the linker parameter to links on a page that points to a target domain '':

<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('set', 'linker', {'domains': ['']});
  gtag('js', new Date());

  gtag('config', 'GA_MEASUREMENT_ID');

You can list multiple string values in the domains property. When the domains property has at least one value, gtag.js will accept incoming domain links by default. This allows you to use the same code snippet on every domain.

gtag('set', 'linker', {
  'domains': ['', '']


If you have forms on your site that point to the destination domain, set the decorate_forms property to true.

gtag('set', 'linker', {
  'domains': [''],
  'decorate_forms': true


To configure the linker parameter to appear in the URL after a fragment (#) instead of as a query parameter (?) (e.g., set the url_position parameter to fragment.

gtag('set', 'linker', {
  'domains': [''],
  'decorate_forms': true,
  'url_position': 'fragment'


Once a user arrives at a page on the destination domain with a linker parameter in the URL, gtag.js needs to be configured to parse that parameter.

If the destination domain has been configured to automatically link domains, it will accept linker parameters by default. No additional code is required on the destination domain.

If the destination domain is not configured to automatically link domains, you can instruct the destination page to look for linker parameters. Set the accept_incoming property to true.

gtag('set', 'linker', {
  'accept_incoming': true

Parameters table

Parameter Type Accepted values
'accept_incoming' boolean true (default if domains has value), false
'domains' array An array of one or more domains, e.g. ['', '']
'decorate_forms' boolean true, false (default)
'url_position' string 'query' (default), 'fragment'