Measure activity across domains

Cross-domain measurement lets you unify, in a single data stream, measurement of the different domains your users visit in the context of engaging with your business, for example, the domain for your ecommerce site and the domain for your shopping-cart site.

With cross-domain measurement, activity is attributed to the same user regardless of domain, which keeps your user counts more accurate and gives you a complete view of the user journey.

When you configure cross-domain measurement, the enhanced measurement option to track outbound links is ignored when an outbound link leads to another domain you identify.

Cookies and cross-domain measurement

Analytics uses first-party cookies to set an identifier for each unique user and session to a website.

Without cross-domain measurement, when a user navigates between multiple sites in different domains, new cookies with new identifiers are set for each website. This would cause Analytics to count separate users with separate sessions.

When you configure cross-domain measurement and a user navigates between sites in the domains you specify (by clicking an outbound link or by submitting a form), the same identifiers are passed from one site to another via a URL parameter identified by the key _gl:, for example: https://www.example.com/?_gl=1*abcde5*.

For Universal Analytics users

If your site has both Google Analytics 4 and Universal Analytics tags, it is important to specify the same domains when setting up cross-domain measurement on both tags. All Google Analytics tags, regardless of type, share the same user identifier (Client ID), so enabling cross-domain measurement on just one tag would result in all tags behaving as if they had it enabled too. Specifying the same domains ensures data consistency.

In Universal Analytics, cross-domain measurement is configured via code (either in the source code through analytics.js or gtag.js, or via Google Tag Manager). In Google Analytics 4, it is configured primarily from the interface. If you're migrating to Google Analytics 4, follow the instructions in Set up cross-domain measurement in the Analytics interface to add the same domains you identified in the Universal Analytics page code.

Note that existing configuration in the global site tag will also be applied to Google Analytics 4. If domains are configured in both the code and the interface, both will apply. However, our recommendation is to set it up from the interface only.

Prerequisites

Each domain you specify needs to use the same Measurement ID from the same web data stream.

To find the data-stream information:

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property you want.
  3. In the Property column, click Data Streams > Web, then click the data stream you want to use.
  4. Under Tagging Instructions, click Global Site Tag (gtag.js).

Set up cross-domain measurement in the Analytics interface

You need Edit permission to set up cross-domain measurement.

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to one of the properties you want to configure for cross-domain measurement.
  3. In the Property column, click Data Streams > Web.
  4. Click the data stream for your website, then under Additional Settings, click Tagging settings.
  5. Click Configure your domains.
  6. Under Include domains that match ANY of the following conditions:
    • Choose a match type.
    • Under Domain, enter the identifier for the domain you want to match (e.g., example.com).
    • Click Add condition to add another domain.
    Conditions are evaluated using OR logic.
  7. Click Save.
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue