Introduction
Google Analytics (GA) is widely used for tracking visitor activity on web pages and many Vuture clients like to add GA to all their web assets to see visitor activity all in one place – in the GA dashboard.
This article explains how to add GA to your Vuture landing pages so that you can also track visitors to landing pages and see the results in your GA dashboard alongside the web results.
This method will aggregate your GA tracking data and make it easy to report, in one place.
This process is independent of Vuture’s own tracking which happens automatically for email landing pages and can also be added to non-Vuture websites as described here.
Historic Data
You can add GA manually to one-off pages that you want to track but for system-wide use you may wish to add it to some or all your templates.This will then work for all future campaigns based on those templates.For assistance with adding GA to all your existing campaigns you should contact Vuture Support.
Instructions for adding GA
The code below should be added near the top of the <head> tag and before any other script or CSS tags, and the string 'UA-XXXXX-Y' should be replaced with the property ID (also called the "tracking ID") of the Google Analytics property you wish to track.
<!-- 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-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
Alternative async tracking snippet
While the JavaScript tracking snippet described above ensures the script will be loaded and executed asynchronously on all browsers, it has the disadvantage of not allowing modern browsers to preload the script.
The alternative async tracking snippet below adds support for preloading, which will provide a small performance boost on modern browsers, but can degrade to synchronous loading and execution on IE 9 and older mobile browsers that do not recognize the async script attribute. Only use this tracking snippet if your visitors primarily use modern browsers to access your pages. The code is below:
<!-- Google Analytics -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+newDate;
ga('create','UA-XXXXX-Y','auto');
ga('send','pageview');
</script>
<scriptasyncsrc='https://www.google-analytics.com/analytics.js'></script>;
<!-- End Google Analytics -->
For more information about this please visit https://developers.google.com/analytics/devguides/collection/analyticsjs/
Google Tag Manager
The Google Tag Manager container snippet is a small piece of JavaScript and non-JavaScript code that you paste into your pages. It enables Tag Manager to fire tags by inserting gtm.js into the page (or through the use of an iframe when JavaScript isn't available).
To implement Google Tag Manager on your website:
- Copy the following JavaScript and paste it as close to the opening <head> tag as possible on every page of your website, replacing GTM-XXXX with your container ID:
<!-- Google Tag Manager -->
<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-XXXX');</script>
<!-- End Google Tag Manager -->
2. Copy the following snippet and paste it immediately after the opening <body> tag on every page of your website, replacing GTM-XXXX with your container ID:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
For more information about this please visit https://developers.google.com/tag-manager/quickstart