Google Analytics and Google Tag Manager tests

Set your Google Analytics IDs

Enter your Google Analytics IDs here:


Google Global Site Tag - UA-XXX-YY + gtag.js

ID: UA-XXX-YY

<head> code:

<!-- Google Analytics - Global site tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXX-YY"></script>
<script>
	window.dataLayer = window.dataLayer || [];
	function gtag(){dataLayer.push(arguments);}
	gtag('js', new Date());

	gtag('config', 'UA-XXX-YY');
</script>
<!-- /Google Analytics - Global site tag (gtag.js) -->

Google Analytics - UA-XXX-YY + analytics.js

ID: UA-XXX-YY

<head> code:

<!-- Google Analytics (analytics.js) -->
<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-XXX-YY', 'auto');
ga('send', 'pageview');
</script> \
<!-- /Google Analytics (analytics.js) -->

Google Analytics - UA-XXX-YY + ga.js

ID: UA-XXX-YY

<head> code:

<!-- Google Analytics (ga.js) --> 
<script type="text/javascript"> 
	var _gaq = _gaq || []; 
	_gaq.push(['_setAccount', 'UA-XXX-YY']); 
	_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>	
<!-- /Google Analytics (ga.js) -->

Google Tag Manager - GTM-XXX + gtm.js

ID: GTM-XXX

<head> code:

<!-- Google Tag Manager - head -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXX');</script>
<!-- /Google Tag Manager - head -->

<body> code:

<!-- Google Tag Manager - body -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- /Google Tag Manager - body -->