5 Minute Hack Set up Google Tag Manager, Google Analytics, And Schema Markup Right Away

Google Tag Manager Tips Every Marketer Should Know so here are some explained below:

1. Crawl for GTM

When you are making plans to apply Google Tag Manager to perform a little quite superb marketing, it is extra than worth taking the time to make sure the base tag code is actually present on each page of your site. It would be a shame if you just rolled out some imaginative tagging to discover after a few weeks that GTM was never on your site’s important pages or whole sections.

Using Screaming Frog we are able to use Custom Search Filters to test that each web page has the bottom code of GTM.

When you open Screaming Frog, go to the “Settings” menu and then select “Custom” > “Search.” It will pull up a menu where a Custom Search Filter can be built for your crawl. Take the GTM ID of your container (e.g., GTM-1234567) and installation one custom seek to find all of the GTM pages, and some other to find all the ones without.

If you have been so inclined, you may additionally use this functionality’s Custom Extraction model to set up a RegEx that attracts from every web page the GTM ID, or IDs. It is perfect if you are accessing an account without historical information and you need to know if there are several different GTM containers all over the web.

2. Inject jQuery

It is necessary to have jQuery available for some of the advanced stuff we’ll want to do (especially step 3 immediately below). Today, it’s cool if you don’t know what jQuery is. In reality, if you aren’t, that makes it all the more relevant because jQuery can make life much easier for someone without a background in growth.

In short, jQuery is a JavaScript library built to make it much easier for you to pick HTML elements and manage interaction events. More than 70 percent of websites today use jQuery, so the odds of you really needing to do this on a regular basis aren’t that high, but if you’re ever in a situation where you can’t get jQuery applied to your site in the normal way, you’ll certainly want an choice like that.

What we will do in Google Tag Manager is essentially using an HTML tag to run a good old-fashioned JavaScript function when each page is loaded. This role is set to:

  • Test to see if they loaded jQuery.

  • If not, go back to the source code and add it (If loaded, great. Nothing else has to happen).

 Inject jQuery for GTM

Now note this isn’t the right, legal way to do it. Why? For what? If jQuery is already present in the source code, the library has an opportunity to load it before anything else on the website occurs. Conversely, the approach we’re talking about here would pinch you through, but it may take up to a complete 2d for GTM to load, run the test, after which load the jQuery library retroactively. Bottom line: Make sure you set this tag to run first on Google Tag Manager before you fire any other complex tagging and tracking.

3. Harvest Click Stream Data

And let’s take a dip in the deep end now: use Google Tag Manager to monitor any click interaction on your site without your development partner being involved. You don’t want to be monitoring every single click every user conducts on your site now in reality. Not all clicks are created equal, of course, so figure out which interaction events are important to you as a marketer and which ones are important to your business. Defines what these are to allow you to track them.

Google Tag Manager provides hundreds of ways to achieve any task (and click tracking is no exception), but this method focuses on elegance and quality. With simply tags in GTM, we’re going to take care of monitoring all of the clicks you want; an HTML tag (for coping with all our click on interactions) and a Google Analytics tag (for receiving andsending data about thoseinteractions).

This is the first HTML tag in GTM where jQuery can come in handy. Using that library, click handlers can be easily attached to any important item on your web. These click handlers will execute a JavaScript function, which will pass click data into your dataLayer when the element in question is clicked (more on that later).

Harvest Click Stream Data

When this occurs, the second GTM tag (a Universal Analytics GA event tag) will listen to information being pushed into the dataLayer, then collect or capture the data and then send it back into Google Analytics as an event you will see in the reports afterwards.

Universal Analytics GA event tag

Of course, the bulk of the work of having this all configured would be to decide which elements you want to monitor and then create a simple naming scheme to make the data readable and navigable of your reports on Google Analytics.

You must also spend a reasonable amount of time finding out how to use jQuery to pick each important item, so you can add a handler to it. To simplify the process, get the Chrome Extension jQuery Unique Selector. This will allow you to find the best way to get in on any given item quickly so that you can add the click handler.

jQuery Unique Selector

4. Test & Release

This is what I love about Google Tag Manager — the opportunity to test a tag setup, fail, test something else, get it to some kind of function, develop it until it’s good, then rinse and repeat, all on your own computer. It doesn’t matter if you don’t have any idea what you’re doing; once you’re ready for prime time, you should hold your research under wraps, and only then post the final version that includes all of your branding.

If you already have Google Tag Manager on your site, that works great. You just fire it up in Preview mode and in a dedicated debugging screen, you will be able to see all of your tagging in practice.

What’s really cool though, is that if Google Tag Manager isn’t added to the site yet, you can even do this. Simply install a Google Tag Manager Injector Chrome Extension, drop in the GTM ID of your container, press Start and you’re ready to go. It’ll be inside your browser just as GTM currently runs on the live platform.

Test & Release



We have established complete implementations at UpBuild earlier than the consumer became cap in a position to connect with their web page the bottom box coded for GTM. When the correct code had gone live all the complex tagging had already been checked and ready to go. That’s a smart way to make sure you’re not trapped in your pockets with your hands while you wait for production cycles.

5. Leverage Environments & Workspaces

Whether your business or client has a multi-tiered development environment, you can use GTM Environments to take the concept of QA and testing to enterprise level. Say the site on which you are working has servers called “development,” “staging,” and “production.”

Without going too deep into the nitty-gritty, what you can do is identify each environment your dev team uses, install a unique GTM container tag on each one, and then selectively move every container you are working on to the correct Testing and QA dev environment. This is awesome, as it will allow several parties to concurrently try things out.

Leverage Environments & Workspaces

And thinking about partnerships, WorkSpaces is a brilliant new app that was rolled out less than two weeks ago. Now, you can have several marketers operating from the same Google Tag Manager account without being afraid to overwrite or remove each other’s tag.

When you start making changes to your account, you will immediately build a new WorkSpace that will keep all your changes until you are ready to move them out as a new version of the folder. When someone else then needs to step in to make an urgent adjustment (say you’re out sick for a day in the midst of setting up some tagging), then publish their changes, they’ll have done it in their own separate workspace, to GTM will alert you that the live container has been changed and will guide you through how to reconcile those changes with your ongoing job. It’s extremely beneficial and it’s a big step forward in Google getting into the management game of business tags.

6. Make (Initial-) Permanent Changes

We’ve been talking a lot of CRO during MozCon because, as we know, being able to hypothesize, explore, introduce, and then keep testing is super essential. But what if your company actually lacks the resources or bandwidth to set the winning stone variation? Uncomplicated. Chop it up with GTM.

Tools like Optimizely create Variation Code from the bottom of your Experiment Editor. So if you know you’ve got a winner, but just yet you can’t get your version made permanent, just Pull that variant code up, copy / paste it proper right into a Google Tag Manager html tag and you are good Remember that this is likely to be a better choice than keeping your experiment running in Optimizely and sending your winning version to only 100 percent If you are with Optimizely on an Enterprise Program, you pay depending on the amount of visitors in your studies. Don’t burn money; get it done in GTM.

Variation Code

7. Track File Downloads

Analytics pros are conscious that Google Analytics isn’t monitoring out of the box by clicking to open a file. But if downloading these assets is considered an event for your organization’s micro-conversion, you need to get the info! Tracking this is extremely easy to configure in GTM.

Track File Downloads

First, you need to activate one of the built-in variables of Google Tag Manager: Click Link. This ensures that if a user clicks on a tag, GTM will be able to “hear” where the connection goes to. You just need to set up a GTM Trigger to track downloads of files, which checks the click URL against the file types you want to track. What you see on the screenshot is a RegEx which matches files such as PDF, CSV, MP3, etc. You then have a dedicated Analytics Tag that sends your data to Google Analytics when the alarm goes off. Bang! Bang. You can then use it in your analytics account to configure goal tracking.

8. Track (Offsite) File Downloads

So what if you send customers or lead links to e-mail files or share those links on social media? You will never see the data in Google Analytics because that single file does not contain any GTM code, let alone tagging Google Analytics. What you need to do is design a system to intercept the user and record the data before they are sent on their way.

The one piece of puzzle you can’t build in Google Tag Manager completely is a pseudo-download tab. This page will only be accessed for a split second, so there’s no need to be something elaborate — a quick “Please Wait While We Prepare Your Download” will be enough.

You will then set up two tags and a few variables using GTM: a Google Analytics tag, An HTML script tag, and variables that pull records out of the URL, as with inside the example. Immediately upon page loading, those variables will grab the information you have passed in (such as which asset the user was sent to and any lead data about that user) and send it to Analytics via your GA tag, after which the second one HTML script tag will dynamically redirect the consumer to the perfect downloadable asset.

9. Track Outbound Clicks

Monitoring outbound clicks is similar to monitoring downloads of on-site files but it needs more gymnastics from GTM. Rather than just turning on an embedded variable, you’ll create what’s known as an Auto Event Variable that captures the hostname of the connection you clicked on. Auto Event Variables allow you to access data points about an event as it occurs, so when someone clicks on a button, we want to be able to catch the hostname of the connection that has just been clicked, because (and this is the clear part) if the hostname is not our website’s hostname, we want to monitor it as an outbound click.

Track Outbound Clicks

Just as with anything, be mindful of how you collect your data and how you actually want it to be used. I’ve seen implementations where every single outbound link in Google Analytics was monitored by printing the entire link URL. Which actionable information would anybody give? Nobody wants to see every single connection here; what you want is to recognize the bigger patterns that are most appealing to your users. So don’t send the entire outbound link URL to Google Analytics; just send the hostname and you’ll get a rundown on how many people have clicked on links to Moz, Wikipedia, Facebook, and so on.

10. Configure Cross-Domain & Subdomain Tracking

When you see your own domain appearing in your reports on Google Analytics, you’re likely getting a subdomain tracking problem. There is a common misunderstanding that subdomain tracking is synonymous with cross-domain tracking and interchangeably using the terms by people. It can make you crazy. Subdomain tracking is of course for when you want to be able to track users on your website navigating between different subdomains.

In this case, Moz will probably see moz.com in their list of referenced domains. That’s because Google Tag Manager does not set the cookie for Google Analytics properly, by default. The default behavior must initially attempt to set the GA cookie as it can. “www” isn’t a real subdomain for the web tab, so the cookie is placed on the “moz” domain on the developer site (which in reality does not exist here, BTW), GTM will first attempt to add the cookie to “dev,” which is a legitimate subdomain, so it stays there. If a user goes to the main site from the dev site, the cookie is set to tell GA that they have already visited dev.moz but not just moz.When they take the path the other way around and come first from the moz domain, it works because dev.moz has on the domain an implicit or ghost cookie.

What we want to do is set “CookieDomain” in GTM to “auto,” which flips matters in backwards. GTM will try to set the cookie for.com on both sites, which doesn’t work as it’s just a domain extension; so the next item it gets to is moz, which checks out so that the cookie is set in the same location on both sites and all is sunshine and rainbows.

Cookie Domain

Cross-domain tracking is when you would like to track users navigating between completely different domains, you guessed it. You want cross-domain tracking only when you have two or more domains that are part of a single user travel. So if you need to send users to a third party website to check out, or if you have a website family that users will naturally go back and forth between them, use this.In GTM, enhancing your web page view tags to “allowLinker” is an easy matter, after which heading To the Cross-Domain Tracking subsection of that identical tag and including a comma-separated listing of your domains.

Then here’s an easy-to-forget part: you need to jump into Google Analytics (not GTM) then add all those domains to your Referral Exclusion List. It is all for naught otherwise. 

11. See Full Hostnames

Talking of subdomains, you’ll want to see those entire domains listed in your GA reports as well. There are other ways to do this with filters inside the GA app but in Google Tag Manager (surprise, surprise) I prefer to do that.

All you have to do is turn on two more built-in variables of GTM: the hostname and the page path. Then, in Google Tag Manager, you hop back into your Google Analytics page view tag and select “page” as the field to create. What this does is allow you to overwrite the page path sent to GA so you can see not only the route (all that comes after.com), but also the hostname that comes before it.

In Closing:

Met with daunting odds, we only have one choice left. GTM empowers us to solve major marketing obstacles, circumnavigate road blocks and make the best out of limited resources for growth.

It’s my opinion that you already have what it takes to become a GTM master if you’ve been driven or encouraged in the least by something you’ve read. Such tools are given, which you should completely check out, will help you to deepen your expertise so that in the future you can come up with your own advanced tips. And keep going on with that, and maximize happily.

Related Post