Understanding GTag and Conversion Linking

You may be wondering…what is GTag? What does it do? How does it work? Do I need it? How does it relate to GTM? Should I use it or GTM or something else?

Top line, GTag brings Google Analytics, AdWords, and DoubleClick tracking together in a simple—yet robust—Javascript library. More about this later.

First, let’s get this out of the way. GTag is not designed for mobile apps. If you are using Google Tag Manager (GTM), stay with GTM. You don’t need to use GTag. GTM does everything GTag does, and more. If you’re using analytics.js or anything older, consider GTag and GTM as mutually exclusive alternatives.

If you only use Google Analytics (GA), AdWords, and DoubleClick, and it’s easy for your to add code to your site, GTag may be the right solution, especially if your site isn’t going to grow and change frequently. If you do more than static tracking in GA, AW, and DC and need dynamic and flexible tracking, then GTM is probably the right solution. This is especially true if you manage multiple marketing pixels, and/or are challenged with website code changes.

 

What’s the Story with GTag?

The drumbeat of progress in Google Analytics (GA) javascript libraries continues. In another step forward, Global Site Tag (GTag or gtag.js) is an upgrade to universal analytics (UA or analytics.js), as was UA to Classic Google Analytics (ga.js), and Classic was to Urchin (urchin.js). In addition to upgrading GA tracking, GTag makes it easier to track other Google Products such as AdWords (AW) and DoubleClick (DC), plus, it includes the new conversion linking feature.

Compared to analytics.js and other versions of GA tracking, GTag provides better control and easier implementation. It does this by eliminating trackers, simplifying custom data collection (custom dimensions and metrics), integrating Enhanced Ecommerce, and providing AdWords and DoubleClick conversion tracking and linking.

 

Basic Configuration for Tracking with GTag

Let’s get a little technical. GTag has a very simple snippet that asynchronously loads gtag.js, initializes a dataLayer, sets up temporary gtag function, and initializes it with a timestamp. In the example below, the basic snippet includes a config call, that sets the default property ID for all subsequent events and triggers a pageview hit. You would put this snippet directly in the <head> section of every page of your website. This is perfect for basic tracking needs and serves as a foundation for AdWords and DoubleClick tracking.

 

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async
src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-X"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-X');   // Send a pageview 
</script>

 

 

Multiple Google Products with GTag

The Javascript call gtag(‘config’, ‘TRACKING-CODE’) is the key. Each Google product has a config call identified by the tracking code prefix; UA, AW, and DC for Universal Analytics (Google Analytics – GA), AdWords, and DoubleClick respectively. With the gtag snippet installed, the call gtag(‘config’, ‘UA-XXXXXX-1’) initializes GA tracking and sends a pageview hit. Adding gtag(‘config’, ‘AW-XXXXXXXXX’) to the snippet will send a remarketing hit to the AdWords account XXXXXXXXX. Adding gtag(‘config’, ‘DC-XXXXXXX’) configures DoubleClick. .

 

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-1'); // Sends a pageview to property 1
  gtag('config', 'UA-XXXXXX-2'); // Sends a pageview to property 2
  gtag('config', 'AW-XXXXXXXXX'); // Sends a remarketing hit
  gtag('config', 'DC-XXXXXXX'); // Configures DoubleClick

</script>

 

Event Tracking

gtag(‘event’, eventName, optional_parameters);

GTag has a simple, yet robust, approach to event tracking, the details of which are too many to get into in this post. The approach is simple because the one call above, with standard events, can automatically fill in the eventCategory (ec) and eventAction (ea). This is great for many common events. It’s simple and robust because it provides a set of recommended events with the defined parameters that let you tame the complexities of enhanced ecommerce.

 

Conversion Linking

Last, but not least, is conversion linking. To provide more accurate conversion tracking, conversion linking for Adwords and DoubleClick uses first-party cookies to store unique IDs for users and the ad clicks that brought them to your site. The values are stored at the top level domain in a cookie named _gcl_aw when the user arrives on the landing page. So when a conversion event happens, probably on another page and possibly in a sub-domain, the event data will include information to link the event to the ad that called the user to action.

GTag has conversion linking built in as a default. Because GTag uses information in cookies set on your domain, it’s important that you provide your users with complete and understandable information about your data collection and that you obtain consent when legally required.

It’s possible to disable conversion linking by setting the conversion linker to false in the config call for the Google product using it. Doing so will reduce your conversion tracking accuracy. The example below is for DoubleClick:

gtag(‘config’, ‘DC-1234567’, {‘conversion_linker’: false});

 

Conclusion

GTag is a simple and robust Javascript library for Google Analytics, AdWords, and DoubleClick tracking. If you’re using one of the legacy GA libraries, and especially if you’re using additional Google Products (AW or DC) and want to take advantage of conversion linking, you should consider GTag or Google Tag Manager, depending on your situation. If you’re using a tag manager, you should keep it (and turn on conversion linking), because GTag is not a replacement for Google Tag Manager (GTM) or any other tag manager.

Post a comment or contact us if you would like more information on GTag for ECommerce, AdWords, and DoubleClick.

Leave a Comment