Tagging just got a lot easier with our GTM Container Template
15 Feb 2016
Starting out with Google Tag Manager and don’t know where to begin? Have no fear, we’ve made it as simple as pie to ensure you can start using GTM tags quickly and easily. And the best part? This powerhouse tool allows you to import containers with ease, so we’ve created a one-size-fits-all* template container for you to use in GTM to get you up and running in no time. (*Ok it doesn’t fit all, but it’s definitely a good starting point!)
What we want to achieve
Setup a pageview tag to send data to your Google Analytics property.
Note: This template configuration will track standard pageviews and is best suited for single domain or subdomain non-ecommerce setups only. More complex configurations such as ecommerce, anonymization of IP and cross-domain tracking have not been configured within this template.
What you will need
For starters, you will need a Google Tag Manager Account and Container set up, along with the GTM code snippet added on your website. For more information on how to install GTM, see Google’s quick start guide: https://developers.google.com/tag-manager/quickstartck here to download
How to import our Template
1. Once you have downloaded the template container, you will need to import it into your account. To do this, head over to the Admin tab in GTM. Select the account and container you wish to import into. Then, click Import Container and choose the periscopix-gtm-template-container.txt template file.
2. GTM gives you the option to either overwrite your current container, or merge the container with your existing setup.
Overwrite: If you are looking to start fresh, Overwrite will remove any tags, triggers and variables currently in your container, and replace it with the imported container. If you are starting out with a blank container, select Overwrite. Note, that a new container version will be created before the import. Meaning the previous draft will be saved as a preceding container version, and the import will be imported into a new ‘Now Editing’ container version.
Merge: The Merge option allows you to keep your existing tags, triggers and variables and add the new ones in from the imported container.
Overwrite: If you have tags, triggers or variables with conflicting names and you wish to overwrite them with the new imported versions, choose this option.
Rename: If you have tags, triggers or variables with conflicting names and you wish to keep both the existing version and the imported version, choose Rename to rename the conflicting imported tag, trigger or variable.
Click Continue and GTM will show you a preview of the import. If you are happy with the import preview, click Confirm, and Bam! Our template is now your container.
Configure your Container
The current configuration of the template container will need one minor tweak for it to send data to your Google Analytics account.
1. In the Variables tab, click on the “Constant – UA Property ID” variable.
2. Edit the Variable Value, and replace it to match your analytics Tracking ID. (This is found in your GA account, under the Admin Tab, in the Property Settings)
3. Hit Save Variable and you’re done.
Preview & Debug
Once the tag has been configured, a quick QA test should be done to ensure all is working as it should.
1. Preview your container by clicking on the arrow next to the publish button and selectingPreview at the top right of the page. Preview mode allows you to browse your site as if the container was live. Once this is in preview mode you will see the following appear in GTM:
2. Navigate to your site and refresh the page. You should see the GTM debug console window appear at the bottom of your page with information about what tags have been fired. For example, if the pageview tag in your container has fired, you will see the UA - Standard Pageview Tag appear under Tags Fired On This Page.
3. To make doubly sure this has fired, you could use either the GA Debugger Tool or check the Network requests.
GA Debug
If you have the GA Debug Chrome Extension installed, ensure that the icon is toggled to On, and head over the Console tab, found in your developer tools, if you’re browsing in Chrome or Firefox use the shortcut: Ctrl+Shift+J. You may need to refresh the page at this point. If the pageview tag has fired, you will see the GA Debugger populate the Console tab with the information about the hit fired. If it has fired correctly, the hittype will be set to pagview, and the trackingId will be set to your Google Analytics tracking ID.
Network Requests
Head over to the Network tab in your developer tools, if you’re browsing in Chrome or Firefox use the shortcut: Ctrl+Shift+I, and click on the Network tab (you may have to reload the page to ensure it has recorded the requests). Within the Network tab, type in “collect” in the filter bar to find the fired UA tag. If you see a network request (highlighted in the red box) then you know a tag has been fired.
To check if this tag is in fact the pageview tag, click on the request (highlighted in the red box above). This will bring up the Headers tab. Scroll down to the Query String Parameters, where you should see the t parameter value set to pageview, and the tid parameter value set to your GA web property ID. For more detailed information on these query parameters please see the following links: tid query parameter or t query parameter.
4. It is a good idea to run your standard QA tests as well to ensure that the tagging has not impacted any functionality on your site. This is highly unlikely, but always best to test!
Publish your Container
Push the changes live to your site once you are happy with your container by clicking Publish on the top right corner and watch the data pour into GA with the magic of GTM. Want to watch it work in real time? Head over to your Google Analytics Real-Time reports to see your data coming in instantly.
To view this blog written by Shahina Meru on Periscopix's website, please click here.
Please login to comment.
Comments