With Google’s gtag.js, the Future is later…

What the heck is a gtag.js and why should you care?

For the past few weeks I have been fielding a lot of questions about gtag.js on the Analytics Course forums. Students are asking why my recommended method of tracking sites is analytics.js, yet their account only allows them to install gtag.js on their site.

The same thing goes for Google AdWords conversion tracking. The only option is to install gtag.js.

What gives?

You may be wondering the same thing since gtag.js is the only script-based tracking option we see inside of our Google Analytics accounts.

Why, Jeff, are you recommending one thing, and Google is saying something different! 

This tag was rolled out with little fanfare, so it’s natural to be confused about what is happening.

This post aims to clear up some of the most common questions.

I’m sure that gtag.js will be awesome, someday

To tell the truth, I don’t know much about gtag.js, because I don’t like trusting my advertising and marketing data to incomplete Google products. I have not used gtag.js, because it would be insane to use it at this point in time. This post will show you why.

Maybe I’m cautious after being burned by Google Wave, Google Buzz and the first time Google released Universal Analytics into the wild.

Or I’m damaged after moving too fast to Google’s “biggest and baddest” systems too soon in the past, and I don’t want to make the same mistake again.

Or maybe I’m just annoyed that Google is forcing this change upon us, yet not even telling their product team at GTM about the change.

Or maybe I’m just hangry because I spent my entire lunch time trying to get the new AdWords interface to load, only to find the new conversion tracking system won’t work in Google Tag Manager. Low blood sugar is no joke, folks.

But the bottom line is that gtag.js is stupid, and I’m pretty sure I hate that it exists. And 6 months from now I will completely change course and announce that I love gtag.js and eat my words. And you’ll be able to dig up this post and point at me and say ha ha!

Yep, I’m definitely hangry.

One tag to rule them all

We’ve all heard this one before. Google wants to simplify user experience and make things easier for us dum-dums who don’t know our mouth-holes from our arse-holes. So they introduce a piece of tracking that is supposed to make things easier.


Because they release an incomplete set of protocols and expect users to make the switch. Because they subject us to their half-baked ideas; standards that aren’t ready for prime-time.

Something that doesn’t even work with other Google products! 

No offense to you, Gtag.js, but WHAT ABOUT GTM?

If you read any of Google’s own marketing materials, it’s clear they think their users are not very smart. They undermine their intelligence with nearly every piece of marketing collateral. Over-simplifying every step of the way. Dumbing things down, as if marketers and analysts don’t want the details.

And yet tools like Google Tag Manager gain mass adoption from users, because we are dying for details. We want the benefits of a technically sound analytics implementation, without the slow cycles that come from putting everything in the hands of developers. Same goes for Google Analytics. It’s successful because it’s accessible to everyone.

There is no reason for gtag.js in a world where everyone uses Google Tag Manager. It is solving the same fundamental problem, only in a more limited way.

What about Google Tag Manager?

This post started when I tried to install conversion tracking for a new AdWords account. I created a conversion event, and was given the following code to place on every page of my site. Plus another piece of code for the conversion event.

First of all, this is way more work than the old method of conversion tracking. But I’ll humor you, Google.

So I went into Google Tag Manager to get this code on the site, only to find nothing of consequence.

No mention of gtag.js anywhere. Just support for the “old” way of doing things. When I say “old” I mean the ways that have worked for years, only to suffer a violent death in the past few weeks. Methods that are now impossible to utilize, since Google no longer displays the parameters you need to make AdWords Conversion Tracking work.

That makes this change not just annoying, but impossible. Google is requiring their advertisers to strip GTM from their site in order to track a Google AdWords conversion. I’m sure that wasn’t their intent, but it’s my reality.

They have changed their entire tracking process with no way to make it work. Forcing an incomplete product on all of us without any support or documentation. C’mon Google, you’re better than this! 

Fortunately, my account needs are simple. So I just imported my goals from Google Analytics and moved on. But there’s no way major advertisers can move this fast. Think about it this way: the internal Google Tag Manager team hasn’t even implemented this yet! And they likely knew about the change for years before it went live.

One swift Google product update made another Google product obsolete. At least until they implement a solution.

Why am I so concerned? Because I think gtag.js breaks Google Tag Manager

Update: I assumed wrong. Here’s a tweet that eased my concerns from Brian Kuhn at Google (aka the guy who is responsible for all the awesome code we use + Google Tag Manager. If he says that they are meant to be together, I eat humble pie. Thanks Brian!) Of course, the second part is really my biggest issue. Will update with responses if there is a solution I’m missing. 

This is a time where I’m prepared to be wrong with my assumption, because I am not 100% certain.

But if I put gtag.js onto my site, wouldn’t it break Google Tag Manager?

The reason why I am suspicious of gtag.js is because is uses the same dataLayer as GTM, but instantiates it independently.

My JavaScript skills aren’t quite at a Simo Ahava or Mike Arnesen level, but I am suspicious of putting these two trackers on the same site. Wouldn’t the first data layer be wiped out by the second one?

If gtag.js is defining the datalayer before or after Google Tag Manager, wouldn’t the datalayer get re-set? My CIS degree says yes, but my hangry status says “go eat something before you pass out.”

Does anyone know the answer here? Is it safe to have gtag.js and GTM on the site at the same time? Is GTM going to be replaced by gtag?

So many questions. So little documentation or answers from Google.

Google, please hire me to manage roll-outs

Here’s my job application.

When you create a new feature or product enhancement for your analytics and advertising products, I will run it through a common sense filter. It works like this.

  1. Internal liaison – I will ask you if this change will cause your other products to break or create a spider trap for users. We will address it before launching.
  2. Voice of the people – I will think of all of the questions that you are going to get from your users, and make sure that they are addressed before the push goes live.
  3. User testing – We will do a soft launch to a small percentage of users to get their feedback on the change, what they like about it and how it can improve.
  4. Proper documentation – I will document the concerns people will have with the switch and thoroughly explain everything that they must do to make this work, how it can be done, and what timeline it should fall into.
  5. Common ground – I will write a note to all users explaining the changes in plain English (and hire local translators if we have the budget), telling them what is happening, and where to find more information.
  6. Closing the loop – I will study analytics for these products to see if there are any nagging issues, and report on whether it was a success or not.
  7. True sentiment – I will implement a survey of users that collects data about their experience, to add qualitative data into the mix.
  8. Diffusion – I will be a cheerleader of the change, telling users about the positive aspects of the new product/feature and championing the usage. I will provide real timelines for when they should implement and how things should best be handled. Users will be thankful for the change by the time I get done with them.
  9. Promotion – Each major change will be promoted to your install base via a videos and webinars to highlight the value of each development.
  10. Acceptance – Users will accept these changes due to strong communication. They will not be happy about change in general (nobody is), but they will be excited to for the opportunity and advanced notice.

That’s the plan. And you don’t even need to hire me, I’m already doing it for you in my training courses.

Of course, bringing me onboard would solve your communication problems and help me reach a bigger audience. You know where to find me.

I still don’t know where gtag.js fits into the world of tracking

Is it replacing Google Tag Manager?

Is it already Google Tag Manager?

When will it be necessary to switch?

When will it support all of the great functionality found in analytics.js?

What will an installation look like if you want to track both AdWords and analytics in the same tag?

What benefit will it provide users over time?

Does it make us more reliant on Google? Or less?

If you have any thoughts, please leave a comment. I am as much a student as a teacher on this one.

About the Author

Jeff Sauer is an independent Digital Marketing Consultant, Speaker and Teacher based out of a suitcase somewhere in the world. Formerly of Minneapolis, MN and San Francisco, CA.

  • Daniel Millican

    Hey Jeff– I’d vote for you for Google Liason! Thanks for clearing this up. Last week while going through your GA course, I had this issue and you addressed it on the forum (it’s refreshing to get such quick responses kudos to you). Thanks for looking out for us and keeping us in the loop!

  • Fred Pike

    Jeff, I was super-confused as well. Thanks for offering as much clarification as you know at this time. Great blog post. I’ll keep referring back to it for new information!

  • Joerg Weishaupt

    Hey Jeff, no need to worry about the dataLayer, window.dataLayer = window.dataLayer || [] does nothing else but either using an already existing dataLayer or creating a new one if none exists yet. So no matter, how often you have that piece of code within your page, only the first one creates a new dataLayer, and all subsequent ones will re-use that one.

    • Thanks Joerg – I appreciate you clarifying!

    • I was going to say the same: don’t worry about the dataLayer object ^^.

  • Charles Brocato

    HI Jeff, thanks for the post. I’m still trying to wrap my head around this new tag and why we need i, I look forward to updates. Thanks Joerg for the data layer clarification. I have an unrelated question, why do you set up tracking in Adwords? Why not use GA and import goals into Adwords?

    • There’s a lot of reasons why I prefer it. But some might unnecessary by now. Might be a force of habit.

      1) It sends data faster to AdWords. It can take 4+ hours for conversions in Analytics to show in AdWords.
      2) There’s less of a chance of false positives. Since it’s all kept in the AdWords family (though I bet this could be easily debunked).
      3) It is a stronger signal to AdWords because it is their native system.

      I think that the second and third are just superstition and not reality, though. So mainly I want the data faster.


      • Charles Brocato

        Yes, I get force of habit and superstition, I have mine as well.

        I’m in lead gen and my conversion tracking consist of calls and form submits. I don’t like Adwords call forwarding and only use with my call extension tracking. I use a third party call tracking system and conversions are recorded as GA events.

        My force of habit has been, just being more comfortable and more trusting of GA. My data never imports cleanly into Adwords and I constantly have discrepancies. I know it’s correct in GA and my third party call tracking but Adwords, so I just rely on GA. I’ve given up on trying to get the data into Adwords correctly. I have been thinking about using DataStudio as a source for reporting and analyzing conversion data.

        • Totally get that, and I can see why GA goals for phone calls wouldn’t import… it’s tricky cookie madness that probably gets lost in the shuffle. I’ve had the same problem, and never really found a great solution

          • Charles Brocato

            Hi Jeff, as much and as long as I have wrestled with this topic I can’t believe I have never seen this page before.

            I’m sure you’re seen it, but in case you haven’t her it is. There is some good info in there about the differences between GA and Adwords conversion tracking.


          • Great resource!

  • Webster

    Hello Jeff, great article!

    Actually I´m a noob and do not understand so much about analytics. Till yesterday I was using GA with cloudflare but decided to add the code on my static site and all the sub pages. So I came across the gtag, analytics.js and Google Tag Manager.

    Then I just decided to go with the gtag and analytics.js and I added both codes.

    Now I see an increase of traffic and don´t know if Google rewards me for adding the new code.

    Two weeks ago I lost 50% of my organic traffic and my PageSpeedInsights Score was 20 only.
    Some days ago I optimized the images etc.. and finally reached a score of 80.

    I actually don´t know if it´s the optimization or the analytics code which brings my traffic back.

    My actual question is, if it´s a problem to use the gtag.js and analytics.js together?

    In the GA account where you can find the Global Site Tag, Google informs about the other implemantations and measurement options https://support.google.com/analytics/answer/7538414

    So I guess it´s just fine to use more than one code. But I feel a bit uncomfortable with it and worry a lot. I just hope it doesn´t count page views twice…



    • Webster – more than one code to the same GA account (UA-XXXX-Y) will double a lot of your metrics. So it’s not great. It will be the same number of sessions, but pageviews will double (because code is firing twice) and bounce rate will go down to zero. I would remove the second code immediately. You only need one. gtag.js OR analytics.js OR GTM. Any of them will work just fine for basic needs.

  • Gtag to me feels like GTM-lite, as well as move to make things universally similar across tracking. I don’t get the feeling that it has any real user benefit at this time, save the fact that if you start with it, moving to full GTM is easier. (unless of course we’re talking about adwords which as you noted doesn’t seem done)

    It also feels very 3/4 done at this point, especially given how often the documentation is changing on it – and that they STILL haven’t put out a post explaining it.

    • Just recorded a video on this topic (will be live 10/30), and I’ve changed my mind since I wrote this post a bit. gtag.js solves a problem that none of us knew we had, proactively. Let me explain. Say that next week we notice 0 conversions from Safari, then it happens for months, maybe years. We blame Google because they didn’t give us a solution. We complain that they are out of date, and FUD ensues. Or we notice the lack of conversions, and see that Google published a solution the day the issue happened, prematurely JUST FOR US to have an option, and we do our best to document while they catch up.

      My guess is that new AdWords roll-out wasn’t planned until November/December timeframe and iOS 11 and new Safari protocol forced the hand prematurely. Now they are scrambling, we are scrambling, etc. gtag.js is the simplest way to solve a third party cookie problem. It’s not a new product per-se, it’s about advertising survival.

  • I agree with the overall sentiment of this article (Google thinks its users are dumb, there’s too little documentation about gtag.js), but I think it’s a little alarmist about what’s broken/missing. GTM and gtag.js coexist just fine, and you can continue to use the same AWCT tags in GTM (or anywhere, really) as before. The conversion ID and label are in the gtag.js code that’s generated when you create the conversion in AdWords.

    As for why gtag.js exists at all… Well, Google thinks its users are dumb, and it’s not entirely wrong. GTM is a good solution for a certain subset of users, who are the kind who have resources to figure this stuff out (either staff time or $$$ to pay agencies or both). But, working as a consultant in the analytics industry, it’s easy to forget that our clients are only a small slice of a vast universe of people who use AdWords and Google Analytics. There are people who are “dumb”, not that they can’t understand GTM, but they don’t have the time or money to commit to figuring it out. For them, solutions that make tracking straightforward are good. For orgs that already use GTM, they seem dumbed-down.

    Moreover, my interpretation of gtag.js is basically GTM-lite: it’s like a GTM container where the tags and triggers and variables are all pre-configured for you to do some tracking for AdWords and GA. I strongly suspect that when it’s a little more mature there will be a really easy process to upgrade from gtag.js to GTM for sites that are ready to take that leap.

    • Agreed. A week after writing this I sent out an update to my subscribers saying that many of my assumptions have already changed. Debated updating this post or keeping it here for posteriority.

  • Efrath

    Yeah, I’ve been confused myself, mainly when it comes to whether gtag is supposed to streamline Analytics and GTM and act as a replacement or alternative to the GTM code or not. Is the thought that a GTM account will automatically be made when you create a new Analytics acount in the future? Am I supposed to replace the ID in the snippet for Tag manager in gtag with the one from a GTM account? I hope they at least will clarify how GTM and gtag is supposed to interact in the future.

    • Think of gtag.js as GTM-lite. It’s got some of the good parts of GTM, but without the GUI (graphical user interface) to control rules.

      With this change, it’s clear that they will NOT automatically create GTM for you in the future with GA. Quite the opposite, this means that they are making you less reliant on GTM and emphasizing it less with this change. Basically they want you to use GTM-lite (gtag.js) until you find a use case where it is no longer sufficient.

      To answer your other question, the ID snippet from GTM (GTM-XXXXXX) has no place in gtag.js. The ID snippets you use in gtag.js are your UA-XXXXX-Y (Google Analytics property ID) and your AW-XXXXXX (AdWords account ID). If you implement gtag.js, you should not use GTM at all.

  • I currently use gtag.js to install Google Tag Manager. Seems to work.


  • Mitchell Teixeira

    Nice post – who needs to really look out for conflicts are those using other tag management tools besides GTM. I wish Google were better at explaining how things work, keeping documentation up to date, and realizing that everyone else doesn’t use their tools exclusively.

  • My biggest issue right now is that on the JavaScript implementation side of things, gtag does not have Tasks like Universal Analytics has. Before a hit is sent to Google Analytics, I can set up a task to add, modify, or even to verify data. I hope they find a way to re-implement it (since gtag doesn’t use trackers) or someone smarter than me can figure out an alternate way to get the same result with gtag.