In August 2017 google analytics introduced a new type of tracking code which is known as Global Site Tag (gtag.js), in coming days it will replace universal analytics tracking code (analytics.js). From now onwards global site tag will be default script which is suggested to implement in your website. But Global site tag is a beta rollout so it may not available for all users.
What Is Global Site Tag (gtag.js)?
As per Google, The Global Site Tag (gtag.js) provides a framework for streamlined web page tagging – giving you better control while making implementation easier. Using gtag.js lets you benefit from the latest tracking features and integrations as they become available.
If we look code of global site tag (gtag.js) and library which are used in this script, it may further support google AdWords and Firebase tracking along with google analytics. With the help of this tracking code, google analytics will release some new and advance features. But till now NO new features are shown in google analytics report.
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
window.dataLayer = window.dataLayer || ;
gtag('js', new Date());
Difference between Universal Analytics (Analytics.js) And Global Site Tag (gtag.js)
- Universal analytics tracking (analytics.js) support only google analytics but global site tag (gtag.js) may support google analytics, Google Adwords, and Firebase tracking.
- js uses (1) trackers to send data to Google Analytics and (2) hit types to specify the types of the data. gtag.js doesn’t use trackers to send data to Google Analytics. It sends data to Google Analytics properties identified by their tracking IDs set by the config command. The event names supplied to gtag.js specify the types of data being sent to Google Analytics.
- analytics.js and gtag.js both use a different type of tracking parameters.
- Unlike universal analytics tracking, Global site tag can be used for conversion tracking.
- Global site tag can be used for remarketing as well but universal analytics can’t.
All limitations which are applied for universal analytics tracking is also applicable for global site tag like hits limit 200,000 hits per user per day and 500 hits per session is same for both.
Set up tracking with gtag.js
Install procedure of global site tag (gtag.js) of google analytics is same as analytics.js, just script snipped is different.
- Create one Analytics property for each website you want to track. Creating a property generates a tracking ID, which you’ll use in your gtag.js tracking code snippet.
- Find your tracking ID, as described below. You’ll use this tracking ID in the tracking code snippet.
- Copy and paste the gtag.js tracking code snippet to each web page you want to track. Add the tracking code snippet just after the <head>tag on each page.
Find your tracking ID
To find the tracking ID:
- Sign in to your Analytics account.
- Click Admin.
- Select an account from the menu in the ACCOUNT column.
- Select a property from the menu in the PROPERTY column.
- Under PROPERTY, click Tracking Info > Tracking Code. Your tracking ID is displayed at the top of the page.
Should I migrate to global site tag (gtag.js)?
If you are using google since very long time and your website receiving a good amount of traffic then it is NOT advisable to migrate from analytics.js to gtag.js, because the only beta version of global site tag is launched yet and developers may be still working on it. So, it’s better to wait sometime because in coming day’s lots of new features will be added. Honestly, these no big change is visible in google analytics report till now.
If you can recall days when Google introduces analytics.js and suggested us to migrate from ga.js to analytics.js, it was a bad experience for big website owners and agencies. While it is true that the Global Site Tag comes with a new syntax as well, it doesn’t require you to retag your site. This is because nestled within gtag.js is the Universal Analytics analytics.js. The functionality is completely the same.
Google mentioned in global site tag documents that “you will be able to benefit from the latest dynamic features and integrations” by using gtag.js so in future some new features will be available for gtag.js but not for analytics.js. So wait for next announcement from Google.
Point to remember about Global Site Tag (gtag.js)
- gtag.js is used to track websites only to track apps you need to use Firebase tracking.
- gtag.js and Google Tag Manager are separate and independent ways of tagging your website. If you want to manage Google and third-party tags from a single location without modifying your site’s code in the future, use Google Tag Manager.
- Migrating from analytics.js to gtag.js will not affect your google analytics data. Google Analytics will track your web page usage as coded, regardless if the code was based on analytics.js or gtag.js.
Google always keep upgrading its products such as Google Analytics, Google Adwords, google search console, google optimize etc. These updates are helpful for users as they provide better information about our websites. Google analytics came a long way from urchin.js to ga.js, from ga.js to analytics.js and now from analytics.js to gtag.js.
As more peoples are adopting digital marketing as part of there marketing strategy, website owners want to know the most accurate analysis of visitors behavior. Global site tag (gtag.js) will help to achieve this goal.