1. Knowledge Base
  2. Publication Analytics
  3. Google Analytics (Universal Analytics)

[UA] Setting up Cross Domain Tracking for Google Analytics in Google Tag Manager

Available_in ENT

⚠️ Universal Analytics no longer processes data for standard GA accounts.
For GA360 accounts, data will stop processing on July 1, 2024.
Make sure you connect your publications to GA4 to avoid losing data.

-- 

Looking at how much traffic came from the publication domain is a great way to identify how well your online publications have performed. To allocate online purchases to the original source (e.g. paid advertising), you need the recorded session to be uninterrupted from the moment the site is first entered until the moment a purchase is made.

By setting up cross-domain tracking, Google Analytics will treat the online publications as part of your own environment, which will prevent the online publications from initiating a new session with a new campaign when it sends traffic back to your site.

In this article:

Prerequisites

If your Google Tag Manager has not been connected to your online publications yet, you can use this article to configure publication tracking in Google Tag Manager.

It is important to consider that adding publication data to an existing property can significantly increase the number of events and page views recorded by the property's views. Make sure to update the filters of each view to either include or exclude the publication data.

Requirements

  1. All domains are tracked by the same Google Analytics property
  2. view.publitas.com and applicable custom domains are added to the referral exclusion list
  3. The Google Analytics configuration for both website and publications have the following setting applied: AllowLinker=true
  4. The Google Analytics configuration for both website and publications include the list of Auto Link Domains
  5. In case publications are embedded, the iframe decorator script is added to website
  6. No UTM parameters are appended to the URLs, linked in the publications

Below, the instructions for each step are described in more detail.

 

1. All domains are tracked by the same Google Analytics property

Make sure that Google Analytics configurations in Google Tag Manager, for both your website as the online publications, are connected to the same tracking ID.

TIP: It can help to have both the website and the publications share the same GA settings. In this case, don't forget to copy over the custom dimensions and the cookieFlags setting from the imported GA Settings Variable before deleting the redundant variable.

2. view.publitas.com and applicable custom domains are added to the referral exclusion list

Add view.publitas.com and the custom domain (if applicable) to the referral exclusion list in Google Analytics. This will avoid new sessions from being recorded when traffic is transferred between domains.

079

Click here to read more about referral exclusion.

3. The Google Analytics configuration for both website and publications have the following setting applied: AllowLinker=true

In the Fields to Set section, add a new field that says allowLinker = true. Ensure this setting is applied to the page view tracking for both the website and the publications.

080

4. The Google Analytics configuration for both website and publications includes the list of Auto Link Domains

In the Cross Domain Tracking section of the Google Analytics settings, submit all domains that require uninterrupted tracking. Subdomains are not automatically included. That is why we recommend adding all relevant subdomains individually. 
Ensure this setting is applied to the page view tracking for both the website and the publications.

081

5. In case publications are embedded, the iframe decorator script is added to website

The allowLinker function ensures that the client ID is shared between domains whenever a link between two domains is clicked. For example, when a link on the website is clicked that will open an online publication. When a publication is embedded on a webpage, both the website and publication load simultaneously and the allowLinker function does not trigger.

In this case, we need to install a separate function in Google Tag Manager to pass along the client ID from the website to the embedded publication.

  1. Download the file attached to this article (see Downloads)
  2. Open the Container, responsible for cross-domain tracking in Google Tag Manager
  3. Go to the Admin section and select Import container
  4. Choose the downloaded file
  5. Select the correct workspace to apply the changes to
  6. Select Overwrite and click Confirm

    082

  7. Locate the Google Analytics settings that is responsible for tracking pageviews of the website.
  8. In the Fields to Set section, add a new field that says customTask =

    083

IMPORTANT!
If you are not using the JavaScript embed code from Publitas, please follow these additional instructions: Locate and edit the CJS - Publitas Iframe Decorator variable and replace [id^="embed-container-publitas-embed-"] with the id (e.g. #publitas-container) or the class (e.g.  .publitas-container) of the div that contains the iframe of the publication.

084

For example, when a publication is embedded like this: 

<div class="publitas-container">
<iframe style="display: block; box-sizing: border-box;" src="https://view.publitas.com/PUBLICATION-URL-GOES-HERE?publitas_embed=maximized" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
</div>

The third line in the custom JavaScript variable needs to look like this:

selector: '.publitas-container iframe',

6. No UTM parameters are appended to the URLs, linked in the publications

With cross-domain tracking active, the online publications are tracked at the same level as other website pages. This means, there is no longer a need for UTM parameters which are used by Google Analytics to help determine the source of external traffic.

Be sure to remove the UTM parameters from the product feed used in Publitas, from the hotspots added manually to the publications (e.g. Link hotspots), and disable the UTM automation feature in case you've used it in the past. 

How to test if cross-domain tracking works

To test if cross-domain tracking is working, you can visit your website, navigate to the online publication, and use the hotspots to navigate back to the website while checking if the Google Analytics client ID is passed along with each step.

To know what Client ID is used, you must find the cookie that stores it. For this, you can use the Chrome browser. Press the F12 key, go to the Application tab, click on Cookies, select the applicable domain from the drop-down list, and find the cookie named _ga :

085

 

Be sure to look for the value of the _ga cookie, every time you navigate between domains to check if it has remained the same. If the publication is embedded, check both the website and publication domains in the dropdown list.

TIP: Avoid having multiple Google Tag Manager variables containing Google Analytics Settings. This may cause Google's javascript to initiate multiple times, resetting the client ID every time, disrupting cross domain tracking.

Need help?

If you are unfamiliar with how Google Tag Manager works or how to navigate the settings of Google Analytics, our Services team can guide you through this. Contact your Success Manager for more information.

 

Downloads

3 KB