How to enable Cross-Domain Tracking in GA4 in 3 steps

Cross-domain tracking is a crucial aspect of Google Analytics setup, especially for websites that span multiple domains or subdomains. When users navigate between different domains or subdomains within the same website, traditional Google Analytics tracking can lose visibility into their session data, leading to inaccurate reporting and incomplete user journey analysis. Below are some common issues and considerations related to cross-domain tracking in Google Analytics

Impact of Improper Cross-Domain Tracking on Marketing Insights

  1. Loss of Session Continuity: Without proper cross-domain tracking setup, each domain or subdomain change can be treated as a separate session by Google Analytics. This results in fragmented session data, making it difficult to analyze user behavior across different parts of the website.
  2. Incorrect Source/Medium Attribution: Inaccurate source and medium attribution can occur when users move between domains or subdomains during their session. Without cross-domain tracking, Google Analytics may attribute all traffic to the referring domain, leading to misinterpretation of the actual traffic sources.
  3. Incomplete Conversion Tracking: Conversion tracking may be incomplete if users initiate a conversion on one domain or subdomain but complete it on another. Without cross-domain tracking, Google Analytics may not properly attribute the conversion to the original traffic source, leading to inaccurate conversion data.
  4. Subdomain Tracking Challenges: Tracking user sessions across subdomains can also pose challenges, especially when cookies are not properly configured to be shared across subdomains. This can result in users being treated as new sessions when navigating between subdomains.
  5. Implementation Complexity: Setting up cross-domain tracking requires careful configuration of tracking codes and cookies to ensure seamless session continuity across domains and subdomains. Improper implementation can lead to data discrepancies and tracking issues.
  6. Third-Party Integrations: Integration with third-party tools and platforms, such as payment gateways or marketing automation systems, can further complicate cross-domain tracking. Ensuring consistent tracking parameters and data sharing mechanisms is essential for accurate cross-domain analysis.
  7. Privacy and Compliance: Cross-domain tracking involves the sharing of user data across multiple domains, raising privacy and compliance concerns, especially in regions with strict data protection regulations like GDPR. Proper consent mechanisms and compliance with data privacy laws are essential considerations in cross-domain tracking implementations.

Cross Domain Issues in GA4Enabling Cross-Domain Tracking in Google Analytics 4 Settings

To enable Cross-Domain Tracking in Google Analytics 4 Property, follow the following:

  1. Sign in to your Google Analytics account and navigate to the existing Google Analytics 4 property for which you want to set up cross-domain tracking. Click on Data Streams, and select your relevant data stream where you expect cross domain data to be collected.
  2. In the left-hand sidebar, click on “Admin” to access the property settings then go to Configure tag settings > Configure your domains .
  3. Enter the domains or subdomains that you want to track in the “Domains to measure” field. Make sure to include the protocol (e.g., https://www.domainA.com) as shown here: Adding cross domains in GA4 data stream.

Click on “Save” to save and finalize your cross-domain measurement configuration settings.

    TAGLAB Web Signup

    Test Cross-Domain Tracking in Google Analytics 4

    To verify the cross domain tracking in GA 4, simply navigate to your website and perform any of the interactions that you expect to refer to the other domain, and monitor the URL behavior. The new URL load should contain the parameter _gl; for example if the domain added in GA4 is domainA.com you should expect to see in the URL: https://www.domainA.com/?_gl=1*xyz1*.

    Troubleshooting:

    • In case you’re not able to see the _gl parameters, make sure that there are no redirects that are removing the parameter
    • If you still are unable to see the parameter, your website settings might be configured not to accept adding such parameters to the query string. In that case you need to discuss with your developers
    • One common reason that might prevent cross domain tracking to work is the presence of links that point from one domain name to another in iFrames

    Also note well:

    • That in case of subdomains you don’t need cross domain tracking to be enables. For example if your website is domain.com, login.domain.com is automatically tracked as same domain
    • If you want to track both domain.com and login.domain.com, the two domain names should be tracked in the same data stream. Meaning that their measurement id that starts with “G-” should be the same

    Shopify Buy Button

    One of the common issues that cause cross domain tracking issues is the shopify buy button integration in case you have the add_to_cart or the checkout call to actions implemented on your non shopify website, while the shopify buy button module sends users to your checkout page on shopify domain name. As detailed by Google for cross domain tracking configuration to work, links must be in plain HTML. Meaning that if the user is forwarded to a next page by a JavaScript function, cross domain tracking will not work.

    Frequently Asked Questions About Cross-Domain Tracking

    What is cross-domain tracking in Google Analytics?

    Cross-domain tracking is a technique used in Google Analytics to track user interactions across different domains or subdomains as a single, continuous session. This method is essential for websites that operate across multiple domains, allowing them to maintain accurate analytics, understand user paths, and measure the effectiveness of marketing strategies across their digital ecosystem.

    What is the ‘_gl’ parameter in URLs for cross-domain tracking?

    The ‘_gl’ parameter is a crucial component in URLs used by Google Analytics 4 to maintain and transfer session and campaign data as users navigate across different domains. This parameter helps Google Analytics stitch together user interactions that occur across multiple domains into a single, cohesive session, thus providing a unified view of user behavior.

    How can I set up cross-domain tracking in GA4?

    To set up cross-domain tracking in Google Analytics 4, access your GA4 property settings, navigate to ‘Data Streams’, and select the relevant stream. Under ‘Configure tag settings’, add the domains you wish to track under ‘Domains to measure’. Ensure all domains are correctly formatted and include protocols to successfully link user data across these domains.

    What should I check if the ‘?_gl=’ parameter is not appearing in my URLs?

    If the ‘?_gl=’ parameter is missing, verify there are no redirects stripping out URL parameters. Also, ensure that your website’s configuration allows URL parameters to be appended. Consulting with your web development team may be necessary to address JavaScript or other technical issues that might prevent the parameter from being added to URLs.

    Do I need separate cross-domain tracking for subdomains in GA4?

    For GA4, separate cross-domain tracking for subdomains under the same primary domain is not necessary if they are included in the same data stream in your GA4 settings. Subdomains are automatically considered part of the same domain, allowing seamless user journey tracking without additional configuration.

    How can I verify that cross-domain tracking is correctly set up in GA4?

    To verify the setup, simulate user journeys that cross different domains and monitor how URLs are constructed as you navigate. Ensure that the ‘_gl’ parameter persists across these domains. Using Real-Time reports in GA4 to see immediate data or checking the User Explorer for session continuity can also help confirm correct implementation.

    TAGLAB Automated Marketing and Analytics Tags Auditing
    TAGLAB Automated Marketing and Analytics Tags Auditing
    GA4 and Looker Studio Marketing Dashboards

    Browse Articles by Category