Get in touch with our team
Feature image for 29.08.2017


3 min read

Google Analytics releases new unified ‘Global Site Tag’ – gtag.js

This article was updated on: 07.02.2022

Recently Google Analytics has quietly released into Beta a new unified site tracking tag called gtag.js.

NOTE: If you’re currently using Google Optimize, or other additional Google tags, consider using Google Tag Manager instead of the new gtag implementation. As of October 2017, gtag is less powerful than analytics.js in terms of allowing for additional plugins to be used in Google Analytics.

This isn’t an upgrade like we’ve seen before – from Urchin to Classic Analytics and Classic Analytics to Universal Analytics. In fact, it’s clear from the tag code that the script is interfacing with Universal Analytics anyway.

What this new release is clearly hoping to achieve is a unified tagging method that can, in time, combine tag requirements for Analytics, Content Experiments (most will now be using Google Optimize) and also conversion.js.

Its code footprint is a lot smaller than analytics.js – and many default settings are rolled in. For example, gtag.js automatically sends pageviews to Google Analytics unless you override this – something which required an additional line of code in previous tag versions.

Should you migrate to gtag.js?

The new Global Site Tag is currently in Beta and as such isn’t covered by an SLA. Also, being in Beta means that there’s a slight chance of future changes, too, so we’d recommend holding on this right now.

If you are still using native analytics.js direct in your application then perhaps instead right now you might want to begin a Google Tag Manager implementation as the dataLayer principle is clearly being brought forward into gtag.js anyway. This would ensure that your tag migration planning is moving in the right direction to access new features as they’re being released, plus would no doubt lead to a much needed tagging cleanup project anyway.

I’ve found the new event tracking methods the most interesting change between analytics.js and gtag.js. For one, the new syntax more closely resembles a dataLayer push event, but also, there is now a list of recommended events which can be fired which coincide nicely with Analytics’ Goal setup menu.

These recommended events now include transactions, lead generations, form fills, logins, shares, and a variety of enhanced ecommerce events we’re already used to (add to cart, add to wishlist, add payment info, checkout process begin, etc).

Google Tag Manager and/or Global Site Tag?

If you’re already using Google Tag Manager then a migration right now is not necessary. The new Global Site Tag will not replace Google Tag Manager (GTM), as the purposes here are very different. A Tag Manager suite, like GTM gives separation of concerns from site code and tag management – and adds in tag governance and the ability to trigger additional external tags outside of the Google ecosystem at the same time.

As Global Site Tag interfaces with the dataLayer and, via proxy, the full Google Analytics suite anyway, no additional benefits will be gained by supporting a gtag.js installation alongside GTM (correct as of August 2017).

If you are currently not using GTM and have no requirement for tighter control over tag management, then now is a good time to begin planning your migration to the new gtag.js, as it will no doubt soon be out of Beta.

If you’ve any questions about this new tag, let me know in the comments below!