Question

We noticed a dramatic dip in site users since implementing Google Tag Manager, but want to ensure we have set this up properly.

We have 1 Universal Analytics code that we use throughout our site (foo.com, subdomain.foo.com), but also use this for a widget that sits on our customers' websites (bar1.com, subdomain.bar1.com, bar2.com etc.). Potentially, multiple Analytics trackers could be loaded on their page, and we do not want to interfere with their Analytics. We have custom events, and with the older analytics, we created our tracker object in this way:

Old ga.js:

var _gaq = _gaq || [];
_gaq.push(['foo._setAccount', 'UA-00000000-1']);
_gaq.push(['foo._setDomainName', 'foo.com']);
_gaq.push(['foo._trackPageview']);

Universal Analytics:

ga('create', 'UA-00000000-1', 'foo.com', {'name': 'foo'});
ga('foo.send', 'pageview');

Then, we implemented Google Tag Manager in all pages, removed the Universal Analytics in code, transferred page views to GTM and set up auto event tracking in combination with the dataLayer syntax.

Universal Analytics Page View Tag Setup

The firing rule for this tag is all pages: {{url}} matches RegEx .* Universal Analytics Tag Setup

Does this set up look correct, to avoid Analytics tracker collisions in the event a customer loads their own Analytics tracker?

Was it helpful?

Solution

In our case, the analytics numbers we were used to seeing were actually getting double-counted in the first place due to Google Tag Manager and Universal Analytics both injecting a site view/page view event.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top