You probably have noticed that the default Analytics tracking code format, listed in your Properties, has changed a few months ago. Over the years, Google has released multiple versions of its Analytics JavaScript library, introducing new features. Global Site Tag is not the same thing. Is designed to simplify and streamline website tagging for Google products as Analytics, AdWords, and Doubleclick. Unlike the standard analytics.js library, global site tag (gtag.js) is a tagging framework and API that allows you to send data to multiple products.
From version 5.4, Analytics Insights for WP provides full support for gtag.js tracking. This means that almost all features available for analytics.js tracking are also supported when enabling the new Global Site Tag tracking code.
Things to consider before switching to gtag.js
Here are a few things to consider before migrating to gtag.js:
- If you’re using an Ecommerce tracking plugin, make sure the plugin supports the new Global Site Tag tracking code.
- Global Site Tag tracking uses the Enhanced ecommerce library by default, so you won’t be able to switch to Ecommerce or to Disable in plugin’s settings.
- If you have defined custom events, outside of the plugin, make sure you update the code accordingly.
- forceSSL parameter is set to true in gtag.js, so you won’t be able to disable it from plugin’s options.
- To track user timing, Navigation Timing API is used. The rate at which timing events are sampled is determined by the total number of pageviews received during the previous day. These being said, the Speed Sample Rate setting is completely ignored.
To wrap things up, the most important issue you should be aware of is the first one. Besides this, there are no notable things to consider.
Adding gtag.js to your site
Since almost all features available in Analytics Insights are supported by gtag.js, I’ve decided to introduce a simple switch on/off button on the main Tracking Code screen, under Analytics Insights -> Tracking Code.
To switch from analytics.js to gtag.js simply choose Global Site Tag.
Other Release Notes
- In Analytics Insights for WP v5.4 I’ve also added support for custom dimensions while tracking AMP pages using Google Tag Manager.
- Google Tag Manager now has a native scroll depth tracking feature, available for both AMP and Web containers. For this reason, the plugin scroll depth tracking feature is not available anymore in tag manager mode. Please use the native feature instead.
- Button submits are now also tracked when track form submit actions option is enabled.