When to use Google Analytics and Google Tracking Tags?

The basic principles behind installing Google Analytics are that the Google Analytics Tracking Tag should be triggered on the page when you load the page as soon as possible. This data will help you to optimise the content of your website and its usability.

Generally, this means that the Google Analytics Tracking Tag is installed as soon as possible in the section of the page’s HTML code, or alternatively, the tag is triggered to trigger in Google Tag Manager with “Page View”. It is recommended that the tag be triggered “as soon as possible” because it would be able to store as much of the traffic as possible on the website and the user would not be able to navigate away from the page before the tag was triggered.

 

 

This is a very good practice, and basically right, but what if there is a situation where the Google Analytics tracking member has not been able to collect all the information he needs from the page/user at the time Google Analytics Tracker is triggered?

The problem of advanced solutions

When you make advanced Google Tag Manager installations, you will often be faced with a situation where the Google Analytics tracking tag should be triggered a little later than “as soon as possible . ” This is because in more advanced tracking solutions, Google Analytics wants to send a lot more data than just the data that Google Analytics collects by default. For example, such additional data may include:

  • User Customer Number
  • User customer group
  • User login status
  • User ID in another system (e.g. ivanreyes.co.uk)
  • product information
  • Number of words per page
  • Page title
  • Page meta description
  • Page template
  • Article Writer

The problem with this kind of data is that the data may not exist when the Google Analytics tracking tag is triggered. Take a simplified example.

The following things happen whenever a user loads a page into a browser:

  • The user clicks on the link or writes the address of the page in the address field, whereupon the browser starts to load the new webpage
  • The first page of the section contains the HTML codeNext, the HTML of the section is downloaded from the page
  • This page uses JavaScript to make it possible to dynamically change additional information to a page
  • The page is displayed to the user.

Adding the default Google Analytics installation to the traditional help that triggers the Google Analytics tracking tag on the page “as soon as possible” , the result will look like this:

  • The user clicks on the link or writes the address of the page in the address field, whereupon the browser starts to load the new webpage
  • The first page of the section contains the HTML code
  • The Google Analytics Tracking Tag is triggered
  • Next, the HTML of the section is downloaded from the page
  • This page uses JavaScript to make it possible to dynamically change additional information to a page
  • The page is displayed to the user.

However, in modern web site implementations, it is common for content and data on your site to be loaded dynamically with JavaScript, and that is why Google Analytics tag is triggered before the site’s data is fully prepared.

JavaScript dynamically and asynchronously downloaded data has such an analyst-like feature that data may appear for use at any time and cannot be predicted very precisely when data is in use. So we want our trace to follow as late as possible so that as much of the data as possible is ready when the data is sent to Google Analytics.

The best of both solutions

When making a professional Google Analytics installation, it is important to make thoughtful compromises.

Page load timeline: The steps involved in a web page load. New Relic Browser charts display the following segments of that process.

 

The earlier the monitoring is triggered, the larger the number of users it covers.

The later the tracking is triggered, the larger the amount of data it covers.

The previous statements require an answer to two questions:

  • If you trigger a tag as late as possible, how many users will not be covered?
  • If, in instead, this triggers a tag as soon as possible, how much of the data will not be sent? The first question can only be answered by examining the website in question and at what stage the data needed for the page loading becomes available.

As a rule, as a rule of thumb, if a website is implemented with a modern JavaScript implementation (React, Node, etc.), much of the required data is only loaded very late in the page loading.

If, on the other hand, website implementation is more traditional, relying on HTML and, for example, PHP (eg WordPress), most of the data is likely to be downloaded before the Google Analytics tag is released.

If you trigger a tag as late as possible, how many users will not be covered? For the second question, we can give you the most complete answer.

We investigated one of our client’s websites and installed three separate clean Google Analytics tracking to trigger a different time for site download. All tracking is installed through Google Tag Manager.

The page loading process proceeds as follows:

  • The user clicks on the link or writes the address of the page in the address field, whereupon the browser starts to load the new webpage.
  • The first page of the section contains the HTML code.
  • First Tracking Tag Launched (Page View).
  • Next, the HTML of the section is downloaded from the page.
  • Another tracking tag triggered (DOM Ready).
  • This page uses JavaScript to make it possible to dynamically change additional information to a page.
  • The page is displayed to the user.
  • Third Tracking Tag Launched * (window.onload).
  • When we examine the data, it looks like this:
  • If you wish, open the table to enlarge here.
Conclusion

So, based on the data, the throwing of all key meters is less than 4% when comparing the values ​​between Page View and window.onload.

In addition, we may question whether such users have a special value for us who visit the site so quickly that even a page does not have time to load properly.

So is it important whether these users are in the monitoring or not?

This is a question that every analyst should be considered in his case, but in their own customer accounts, I have come to the conclusion that if you visit a website, but in practice very quickly without seeing the pages at all, post analytics won’t be predominantly important. So I can safely trigger Google Analytics tracking only with the DOM Ready Valve or, if I want, with window.onload valve.

In some cases, depending on the implementation, the window.onload valve event may be triggered before the page is displayed to the user or much after the page is displayed.

Technically, window.onload means the moment when all page elements and external resources have been downloaded, and not the moment when the page is displayed to the user. Often, however, displaying the page to the user and the window.onload event are very close to each other.

error: Content is protected !!