Last Tuesday, we held a webinar on the technical implementation of
Google Tag Manager, a free tool that makes it easy for marketers to add and update website tags, freeing up webmaster time while providing users with more reliable data and insights. This technical session includes a more in-depth look than our
introductory webinar, illustrating how the product operates in a live environment and showing how flexible Google Tag Manager is for enterprise systems.
Watch the webinar video here for:
- Step-by-step implementation process live product demo
- Advanced use cases, including the Data Layer API
- Best practices and common pitfalls
And don’t forget to download our handy implementation
Cheat-Sheet, which outlines each of the steps involved in migrating onto Google Tag Manager.
And as usual, we like to provide a recap of some of the top questions we received during the webinar. Please note that this webinar is intended for technical audiences, so some of the Q&A below gets into the nitty-gritty technical details. If you’re less experienced technically, we invite you to check out our
forum or reach out to one of our
certified partners for implementation assistance.
Questions and Answers
Where can I find more detailed information about all of this stuff?
In addition to the walkthrough we provide in
the webinar and our
Cheat-Sheet, you can find a detailed description of the implementation process in the
Google Developer docs, and helpful articles about how to use the Google Tag Manager user interface in our
Help Center, including some notes about what to think about
before you begin implementing. And as noted above, if you still have questions, check out our
forum or reach out to one of our
certified partners for implementation assistance.
Where can I place the GTM snippet? Can I put it in <head>? Does placing it in the footer have any adverse effects? Can I place the data layer in <head>?
The recommended location for the GTM snippet is just after the opening <body> tag. The only exception to this would be in the case where you want to declare page-level metadata by declaring the data layer immediately above the GTM snippet.
The GTM snippet can be deployed later in the page, like the footer, but doing so increases the time before the snippet loads. This can cause incremental amounts of data loss, since the user could navigate away before all your tags finish loading.
We do not recommend placing the GTM snippet in head, because the GTM snippet contains an <iframe> for the <noscript> case. Iframes are not officially supported by any browsers in <head> and might cause unexpected behavior.
What should I do about collecting macros and tagging events if I don’t have access to my client’s site or if IT is too busy?
If you can’t access values on the page via the data layer, there are several different Macro types to help you capture data without needing a code change. These include DOM element, DOM attribute, and JS variable macros. Simply input the ID or variable names, and the macro will pull out the data for you. NOTE: If you go this route, you may want to accompany the tag being fired with an “{{event}} equals gtm.dom” rule. This makes sure the element has loaded in the page before you request it, so you don’t get an undefined macro value.
If you're trying to add events to the page, currently this requires code changes. We're working on a solution that doesn't need code changes, but in the meantime we've heard of a couple of folks using the Custom HTML template to inject the dataLayer.push() API into relevant parts of the page. We can’t guarantee this as a solution due to the asynchronous nature of tag loading in Google Tag Manager, but we have heard some success stories.
How do I do cross-domain tracking in Google Analytics using Google Tag Manager?
It's now possible to do cross-domain tracking in GA using the custom HTML template and a new track type within the Google Analytics tag template. We've got some exciting things in the works here to make cross-domain tracking even easier; stay tuned for more soon.
Do you have any account and container setup best practices? What if I’m an agency? What if I have separate sites for mobile and desktop?
In general, an account should be owned by a single advertiser or publisher. Within each account, there can be multiple containers, and containers should be split according to how the site or sites are managed. For instance, if there’s a separate marketing team managing different countries and therefore probably different tag vendors, then there should be a separate container per country. If you have a mobile site and a desktop site that use the same tags across both subdomains, then you should probably only use a single container. We have found that one container per domain is pretty standard, but there are always different situations that call for a different setup.
If you’re an agency, we strongly recommend that your client creates the initial Google Tag Manager account and container, and then have your client add you to the container. Google Tag Manager includes
user permissions controls as well as multi-account access to make it easier for agencies and clients to work together.
Are all tags with document.write off limits? Are there any workarounds?
Most tags that utilize document.write are just trying to construct an image pixel with dynamic parameters using JavaScript. Luckily, our Custom Image Tag allows you to construct an image pixel with dynamic parameters. Look at the tag you’re trying to add, pick out the URL, paste it into the Image URL field, and then add any dynamic variables by using the {{macro}} syntax. See the live demo in the webinar video above for an example of how to do this.
Do not add tags that contain document.write in either the initial snippet or in any linked JavaScript. Doing so will cause undesirable effects.
How do Google Analytics events differ from Google Tag Manager events?
Events in Google Tag Manager are basically an indication that this is an event where other tags could fire. It does not collect any data. GTM events are used in tag firing rules to initiate the placement of other tags.
Google Analytics events are actually data events, and can be set up in Google Tag Manager via the Google Analytics template, tracking type “Event”. This tag sends data to Google Analytics to be reported on within the Google Analytics interface.
~~
We hope the webinar and Q&A will help you implement Google Tag Manager smoothly and easily -- many business, including
GoPro, are already enjoying easier tagging. Keep watching this blog for more tips and tricks!
Posted by the Google Tag Manager team