Global Site Tag: the new Google tracking code

September 05, 2017 - Written by

Approximately one year after the lauch of autotracking plugin 1.0, Google releases a Beta version of a new kind of tracking, named “Global Site Tag” or gtag.js.

What is it about? We’re talking about hard-coded tracking and, as far as we know, it provides a framework useful for dealing with the tracking of the tools offered by Google: “measurement, conversion tracking and remarketing products”. We then expect that, shifting from an embryonic Beta version to a more structured one, the new tag will easily support the tracking of AdWords, Optmize as well as of the whole different apps.

Even if it seems we are back to the time of the migration from ga.js to Universal Analytics, now you do not need to remove the old tracking code from your website, because it hopefully iterfaces with the same analytics.js library.

Google Global Site Tag Setup

To setup the new tag you only have to include, after the opening of the <head> tag, the following code: In order to complete the tracking, you have to replace the GA_TRACKING_ID with the in-use web property and the code is set.

What? Is “send pageview” missing? Absolutely not! The snippet automatically enables pageview tracking to Google Analytics, without adding any commands. If you need to disable the automatic page tracking, you need to add this line of code: 

Automatic Event Tracking

The main feature of the code at present is the event tracking. By default, for the tracking of many users actions, Category, Action and Label are automatically rolled in. Let’s say we want to track as an event the number of the newsletter signups. Using the Global Tracking the code to be included in the subscription validation form is the following:

The system will automatically pass to Google Analytics the following information:

  • Event Category: Engagement
  • Event Action: Sign_up
  • Event Label: Landing_A, i.e. the information pushed by the ‘method’ instruction.

Follow the link to discover all the automations for the automatic event tracking using gtag.js code.

If for some reasons Google labeling for the automatic tracking is not consistent with our expectations, or in the case we need to configure an event which is not included among the pre-set events, we can override/specify the standard Category, Action e Label fields.

In our example, the Event Category will be “Registration” while the Event Label will be “User Logged”.

More remarkable features

The new code, at present, covers all the functions that can be created with analytics.js, except for Experiments. If you are still using it…shift right away to Google Optimize! From the first look the remarkable features are:

  • Send data to one or more properties through a single command line

  • The option of specifying “groups” of properties to which data can be sent

As you can see above, you can set a property to a group by identifying it with the value assigned to ‘groups’ and by passing the event afterwards to the specific group of properties, using the command ‘send_to’ name of the group.

When gtag.js should be used?

The documentation provided about the new tag states that “you will be able to benefit from the latest dynamic features and integrations”. That means new features related to the new tag will be released and they probably will not be available for analytics.js.

But wait! Please do not hurry to change tags, remove GTM and so on.

If you are using a tag management system, like Google Tag Manager, continue to using it as this new gtag.js tag is a Beta version and

  • it doesn’t replace GTM
  • it is not covered by a minimum SLA
  • at present it doesn’t allow to manage external tags out of GA
  • at present it generates the same functions of analytics.js
  • it doesn’t support Tasks

If you are interested in using it we recommend to test it in a debugging area or in a staging site to understand if it can be helpful to speed up the tracking setup.

If you want to get your hands dirty, here you can find the link to the official Google Global Site Tag documentation

Comments One Reply to “Global Site Tag: the new Google tracking code”

Leave a Reply

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

  • Analytics Boosters
    Italy

    Vicolo Buranelli, 2
    31100 Treviso
    Italy


  • Analytics Boosters
    United Kingdom

    90 Long Acre, Covent Garden
    London - Greater London
    WC2E 9LY
    United Kingdom


  • Analytics Boosters
    United States

    80 S.W. 8th Street
    33130 - Miami
    Florida
    United States of America


CONTACTS

Contact us