URL contains more than one Google Analytics code

This means that the URL in question contains multiple Google Analytics snippets.

Why is this important?

Google Analytics is a popular, free tool for tracking website visitors and how they engage with content on your website. 

This Hint highlights instances where more than one Google Analytics code was found, which might imply a configuration error - such as a plugin inserting an additional code.

However, it may also be deliberate and nothing to worry about. For instance, using multiple tracking codes might be useful if users with access to different properties need to see data from the same web site, or if you have multiple versions of a web site.

What does the Hint check?

This Hint will trigger for any internal URL that contains 2 or more Google Analytics tracking scripts within the rendered HTML.

Note: this Hint will not trigger if there is Google Analytics code siting within a Google Tag Manager container, as Sitebulb will not fire the GTM script in order to find the Google Analytics code.

Examples that trigger this Hint

The Hint would trigger for any URL which contains multiple Google Analytics tracking codes (e.g. UA-94756635-1), using any combination of the methods below.

gtag.js

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-XXXXXXXX-X');
</script>

analytics.js

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

ga.js

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-Z']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

urchin.js

<script src=”https://www.google-analytics.com/urchin.js” type=”text/javascript”></script>
<script type=”text/javascript”>
_uacct = 'UA-XXXXXXXX-U';
_userv = 2; urchinTracker();
</script>

Why is this Hint marked 'Advisory'?

The site may be deliberately tracking Google Analytics twice, which is entirely legitimate. However this Hint becomes useful if, as is often the case, the code has been accidentally duplicated.

This can cause both codes to send hits to the same property, resulting in inaccurate data collection. Google have a Chrome extension, Tag Assistant, which can help debugging these situations.

This Hint becomes useful when you audit a site that does actively use Google Analytics, as it will highlight the URLs for which the Google Analytics code is not present, allowing you to check and potentially fix this.

Ready to try Sitebulb?
Start your free 14 day trial now

Start Free Trial