Search code examples
google-analyticsgoogle-tag-manageruniversal-analytics

_ga querystring, is this part of classic or universal google analytics


I help manage a site that had classic google analytics installed and it has recently migrated to universal analytics via Google Tag Manager.

Now when travelling to a subdomain google is appending the cookie information to the anchor, as a querystring value.

?_ga=1.94005085.150702697.1452253355

Apparently this has didn't happen with classic analytics, even though the set up is like this:

pageTracker._trackPageview(getPageUri(true));
pageTracker._setAllowLinker(true);

Does anyone know if the url will be changed when travelling to a sub domain on classic analytics with the above options?


Solution

  • This is down to how your cookies are setup. For hypothetical purposes assume that your website and subdomain are:

    • www.website.com
    • subdomain.website.com

    These domains can share a cookie and therefore share the Google Analytics information however unless you specifically set the custom variable of cookieDomain to auto (with GTM tag setup: #3 Configure Tag > More Settings > Fields to set > + Add Field > cookieDomain | auto) you essentially have two distinct cookies for each domain.

    I also presume you have then also setup "Cross-Domain Tracking" and included "website.com" within "Auto Link Domains" setting in GTM.

    TL;DR: Updating your cookieDomain settings to utilise "auto" will force GTM to first attempt to set a cookie for .com (which will fail) and then attempt to set one for "website.com" (will work work) and your cross domain tracking won't be required.

    Bonus info: However to add some context for your question the code pageTracker._setAllowLinker(true); allows the linker to be applied to URL's in Classic Analytics, you would still need to decorate your links with code such as below, if you didn't have this before your links wouldn't have included the linker code (and wouldn't have shared cookied if on different cookie domains/paths).

    <a href="http://www.my-example-blogsite.com/intro"
    onclick="_gaq.push(['_link', 'http://www.my-example-blogsite.com/intro.html']); return false;">
     See my blog</a>