Categories
Explainer Public

Google Analytics: Cross-Domain Tracking

We usually don’t have to worry about cross-domain tracking; most of what we are concerned with is actually tracking across sub-domains.
Tracking clients across sub-domains of gmu.edu typically works by default.

Tracking Clients Across Sub-Domains

Tracking clients across-sub-domain tracking in Google Analytics works by default, unless:

  • you are using an outdated version of the GA tracking code.
    The current version of the GA tracking code (analytics.js) will track clients across sub-domains automatically; the older ga.js version will not.
  • you have taken specific steps to limit cross-sub-domain tracking.
    For example, changing the cookieDomain field from its default of ‘auto’.
    For more information on this, see: The Google Analytics Tracking Cookie

Tracking Clients Across Domains

We only have to worry about cross-domain tracking when clients leave our website (on gmu.edu) for another website on a different domain (not gmu.edu), and:

  • we have the ability to implement our tracking code on the other website, and
  • we want to track what they do on the other website (as being the same user), and/or
  • they will be returning to our website, and we want to track what they do when they get back yo our website (as being the same user)

For example, lets take a case where we send clients off of our domain to fill out the request information form within our CRM. Once they submit the form, they return to our website.

gmu.edu -> hobsonsradius.com -> gmu.edu

Two factors influence the ability to correctly track clients across domains:

  • the tracking code implementation
    Our GA tracking code must be present and configured correctly on both websites.
  • the referral exclusion list
    GA must know not to count the return links to our site as new visits from the second domain name.

Linker Plugin

In order to configure the Googler Analytics tracking code to handle cross-domain tracking, you need to set it to use the Linker plugin. This plugin will cause GA to listen for clicks on links to the linked domains. In the event that a link to the linked domain is clicked, the Linker plugin will add the GA client ID to the URL as a query parameter. This link is modified by the GA linker plugin to include the _ga parameter on the URL. This parameter is picked-up by the GA tag on hobsonsradius.com, which enables it to connect the page views to the same session (the cookie readble by gmu.edu and the cookie readable by hobsonsradius.com).

Referral exclusion List

For the domains listed in the Referral Exclusion List, GA will always instead use “(direct)/(none)” for the traffic source, instead of “referral/b.com”. An interesting this about GA is that it does not override the existing traffic source with a change in source to “(direct)/(none)”.

See The Google Analytics Referral Exclusion List post for more information.

Phase 1: Tracking code on primary website. No tracking code on secondary website. Referral exclusions list not set-up.

User hits gmu.edu and starts a new session.
User follows a link from gmu.edu and hits hobsonsradius.com. hobsonsradius.com does not have the analytics tracking code, nothing is tracked.
User follows a link back to our website from hobsonsradius.com and hits gmu.edu again. Even though there is a session ‘open’ for the client in gmu.edu already, GA interprets the link click as a referral from hobsonsradius.com to gmu.edu. GA automatically starts a new session when the referrer changes (which makes sense). Therefore the second page view starts a new session.

Phase 2: Tracking code on both websites. Cross-domain tracking not set-up. Referral Exclusions list not set-up.

User hits gmu.edu, which starts a new session.
User follows a link from gmu.edu and hits hobsonsradius.com. Even though hobsonsradius.com tracks the page view, there is no way to connect this hit to the previous hits on our website. This is because the GA identification cookie was set on gmu.edu, and is not accessible to hobsonsradius.com. And since cross-domain tracking is not set-up, GA cannot transfer the client ID via link.
User follows a link back to our website from hobsonsradius.com and hits gmu.edu again. Even though there is a session ‘open’ for the client in gmu.edu already, and the client ID in the cookie can be read, GA interprets the link click as a referral from hobsonsradius.com to gmu.edu. GA automatically starts a new session when the referrer changes (which makes sense). Therefore the second page view starts a new session.

Phase 3: Cross-Domain Tracking Set-Up. Referral Exclusions list not set-up.
User hits gmu.edu, which starts a new session.
User follows a link from gmu.edu and hits hobsonsradius.com. Because cross-domain is set-up between these two domain names, the same client session is able to be maintained.
User follows a link back to our website from hobsonsradius.com and hits gmu.edu again. Even though the hits can be linked into one session by the client ID, this still starts a new session, since the referrer has changed, as described above.

Phase 4: Cross-Domain Tracking Set-Up. Referral Exclusion List Configured
User hits gmu.edu, which starts a new session.
User follows a link from gmu.edu and hits hobsonsradius.com. Because cross-domain is set-up between these two domain names, the same client session is able to be maintained.
User follows a link back to our website from hobsonsradius.com and hits gmu.edu again. The hits can be linked into one session by the client ID, and since gmu.edu knows to exclude hobsonsradius.com as a referral, the visit keeps its referral information and maintains the same session.

Leave a Reply

Your email address will not be published. Required fields are marked *