Should you Upgrade to Gtag.js? What is Gtag.Js?

Google Analytics, Universal Analytics, Google tag manager and now Global tag or gtag.js. History of Google Analytics has been filled with library changes. I am sure everyone has a million questions about this new kid on the block.

What is gtag.js?

Why one more tag?

What are differences between gtag.js and analytics.js?

What are differences between gtag.js and Google Tag Manager?

Should I upgrade to gtag.js?

This article will try and answer these questions about gtag.js.

What is gtag.js?

Gtag.js is often confused as a new version of google analytics library, but the scope of gtag.js is far wider than google analytics. If one has to compare it then it is very similar to Google Tag Manager. Gtag.js which is also known as Global Tag is supposed to be the god of all Google tags.

Right now Google products /tags which support gtag.js are

  • Google AdWords conversion tracking and remarketing
  • Doubleclick Campaign Manager and Doubleclick Bid Manager
  • Doubleclick For Search
  • Google Analytics
  • Keep an eye on more Google products being added to gtag

Before Gtag.js (Global tag) to use any of these Google products there were 2 ways to instrument tag on your website.

  1. Hardcoding tag in your code: With this method, you needed to embed several tags in your page and pass the necessary variables like transaction value, id etc. The process flow for this method was like chart shown below.
  2. Instrumenting via Google Tag Manager: Google Tag Manager revolutionalized the way tags are instrumented, it was dream come true for every marketer where instrumenting the tag was not release dependent. The entire process almost had no dependencies coding time. The process flow for this looked like this.
  3. Gtag which is also known as global tag seems to be a continuation of Google Tag Manager where one doesn’t need to instrument different snippets for each product and still can send different information based on variables and ids. The data flow for gtag will look like this.

What are differences between gtag.js and analytics.js?

Analytics.js is JavaScript library used to collect data for Google Analytics only while gtag doesn’t collect data for any one product but acts as a bridge between page and libraries for each Google product to send data.

Should I upgrade to gtag.js?

This is a million dollar question and the answer will depend on your current set up. Let’s take a look at a few scenarios.

  1. On your current set up you are using analytics.js as a hardcoded tag inside the page: In this scenario upgrading to gtag.js certainly ads value with making management of all your google tags easier and streamlined with just one tag managing all libraries. As shown in the chart below if you are using your tags directly in page code this is how the data will flow.hardcoded-tags
  2. On your current set up you are using Google Tag Manager. In this scenario using gtag.js may not add any value and it’s probably best to not to migrate to gtag.js.As shown in the chart below if you are using your tags directly in page code this is how the data will flow.Google Tag Manager
  3. And this is how data flow from gtag.js will look like, which is pretty similar to Google Tag Manager.Gtag Global tag

Advantages of Ggag.js (Global Tag)

There are some obvious advantages of Gtag.js which we have already discussed above but there are a few advantages which are not explicitly mentioned in Google documentation and more of derived advantages which I could figure out from gtag.js code and the data which is being sent to Google Analytics.

  • Event tracking with gtag: Official document doesn’t mention anything specific about change in event structures from “Category” “Action” & “Label”. But few new parameters have surfaced which seem to suggest that finally, Google Analytics may be moving beyond standard GA event parameters. For example Gtag documentation mentions a sample event as
    gtag('event', 'login', {'method': 'Google'});

    its evident this event is completely different than usual Google analytics event. And the network call for this event shows that Google Analytics converted this code to event category as “engagement”, event action as “login” and event label as “google” as shown in the screenshot below.

    Gtag Network Call
    Gtag Network Call



    There are several other examples which are almost like an official announcement this change in GA. For example

    gtag('event', 'sign_up', {
    'method': 'google',
    'account_type': 'basic'

    Network call for this event shows event category as “engagement”, event action as “sign_up”and event label as “google” while completely omits key “acccount_type” and value “basic”

    Gtag New Paramenters
    Gtag New Paramentersq


  • There are several new parameters like this visible in gtag documentation and there is a specific mention of this change as well. ” gtag.js includes an event and parameter model that provides detailed reporting and allows you to benefit from future features and integrations as they become available.”  This seems to suggest that Google Analytics is moving away from Category, Action and Lable event construct towards a construct of key-value pairs which will provide a lot more freedom to analysts the way their data is collected and presented.

All in all, if you are already using Google Tag Manager, gtag.js may not add a lot of value to your instrumentation in short term, but in long-term, if Google Analytics really moves to already widely used key-value event construct it may prove to be a game changer.

Stay tuned for exciting updates on gtag.js by signing up for my weekly newsletter for latest on digital marketing and analytics.

Sign up & Get Free Google Analytics Audit Tool!


Please follow and like me:

AuthorNIkhil Parachure

Nikhil is nothing short of "Swiss Knife of Digital Marketing" over the course of last 10 years he has been involved in practically every facet of Digital Marketing and Analytics. Starting career with paid search Nikhil has built and managed award winning digital campaigns, has been Google Adwords Top Contributor, Planned and implemented several complex and large scale web and mobile analytics implementations. Currently working for a leading ecommerce platform in India as Head of Digital Marketing Nikhil has also conducted analytics and marketing trainings for several MNCs.

Leave a Reply

Your email address will not be published. Required fields are marked *