Sunday, May 19, 2024
HomeTechnologyAdvantages not found in analytics.js by using gtag.js !

Advantages not found in analytics.js by using gtag.js !

It’s been nearly a year since the new gtag.js tracking code interface was released. On the other hand, Google Tag Manager still does not support gtag.js, so I think there are many people who hardly use it. I personally don’t think you need to migrate to gtag.js if you’re using Google Tag Manager.

thumbnail 7

However, in the past month or so, reading the source code of gtag.js and actually using it, I have come to realize that gtag.js has some advantages that analytics.js did not have.

Therefore, in this article, I would like to discuss the advantages of gtag.js.


GA Event Tracking Standardization

Event Tracking consists of four items: “Event Category”, “Event Action”, “Event Label” and “Event Value”. In previous versions of analytics.js, “what to set for each item” was not defined. Recently, guidelines for recommended values ​​have been described in “About Events” in Google Analytics Help, but they are only described in a small part of the help articles, and there is no mechanism for general penetration. not.

On the other hand, in gtag.js, for specific user actions such as “login”, “add to cart”, “search in site”, “share”, “event category”, “event action”, and “event label” have “such a value Please set it”, and the mechanism to follow the guideline is implemented at the source code level.

For the event tracking implementation of gtag.js, for example,

gtag('event', 'login', { method: 'Google' });

will send event hits like “event category = engagement”, “event action = login” and “event label = Google”. Similarly, a total of 19 event recommendations have been defined and implemented. For details on the 19 events, please refer to the developer help ” Measure Google Analytics Events “.

According to the official help description,

We generally recommend using the default Google Analytics event. Default events are preconfigured with default categories and labels. Using these events helps ensure reporting consistency and interoperability with future features.

There is a description like this, and it seems good to implement according to these naming conventions in order to take advantage of the functions that will be implemented in the future.

Ease of extension to other products

A common case is that you have already implemented Google Analytics and want to start new with Google Ads. Normally, you would need to implement some tags for Google Ads. Especially if you want to do dynamic remarketing ads on EC sites, the implementation will be a lot of work.

However, gtag.js has a mechanism that can solve such problems if you use standardized event tracking.

Specifically, when implementing enhanced e-commerce features, if you used standardized event tracking such as “view item”, “add to cart”, and “checkout progress”, activate Google Ads. The tag for dynamic remarketing is completed just by adding a single line of command for conversion).

Even without assuming dynamic remarketing, the remarketing tag of Google Ads with each action added as an attribute is sent to “search”, “share” and “sign_up”, so the media side It seems to be used for remarketing signals.

Also, as far as I read the source code of gtag.js, it seems that it supports not only Google Analytics and Google Ads, but also tags of Floodlight and other Google-based platforms, so it is possible to introduce those platforms more simply. It seems that it will be

On the other hand, these mechanisms are based on the standard event tracking recommended by gtag.js, so implementers of Google Analytics will need to use standard event tracking.

As far as the source code of gtag.js as of May 2019 is confirmed, in addition to “Google Analytics” and “Google Ads”, the tags of “Floodlight”, “Google Flight” and “Google Hotel Ads” also support gtag. seemed to be doing

How to expand to another specific product

First, let’s assume that Enhanced Ecommerce is already implemented with gtag.js. For example, when the product detail page is viewed,

<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
  gtag('event', 'view_item', {
    "items": [{
      "id": "P12345",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "price": 2400
    }]
  });
</script>

will implement code like With the implementation up to this point, implement the remarketing tag to activate dynamic remarketing ads in Google Ads. Normally, you would need to set and implement the product information again in the Google Ads dynamic remarketing tag. However, for gtag.js,

<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
  gtag('config', 'ADS_ID');
  gtag('event', 'view_item', {
    "items": [{
      "id": "P12345",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "price": 2400
    }]
  });
</script>

just one line, like

gtag('config', 'ADS_ID');

Just add the .

The original gtag('event', 'view_item', {...})command is not a command for Google Analytics, but a command for gtag, and with this command as a trigger, it is an image that tags of activated products such as Google Analytics and Google Ads operate. The point is that this command is not for Google Analytics .

What is the future of gtag.js?

From here on, it’s just my imagination, but gtag.js has a plug-in function, and using that plug-in, it is assumed that tags other than Google products will be incorporated into the world of gtag. I don’t think so. This is because the standardized event tracking recommended in gtag.js actually defines events with exactly the same content on Facebook, and Facebook published such specifications earlier. In other words, gtag’s standardized event tracking follows Facebook’s specifications .

If that happens, I think we’ll be able to complete the implementation of Facebook’s tracking code simply by adding one line of code to gtag.js. If tags for Yahoo Promotional Ads, Twitter Ads, etc., as well as Facebook, could be similarly plug-inized, the implementation work would be greatly reduced.

summary

This time, I tried to summarize the merits of gtag.js, which is not often heard about being implemented even though it has been about a year since its launch.

Although it was found that implementing gtag.js has some advantages, it is not yet compatible with Google Tag Manager at the moment, so the timing to officially introduce gtag.js is still ahead. felt.

However, I feel that the potential of gtag.js is very high. In order to be able to take full advantage of this potential when it is fully realized, for the newly implemented Google Analytics event tracking, we will implement events with a standardized naming convention (in analytics.js) and get used to it from now on. I felt it was good.

RELATED ARTICLES

Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Most Popular

Recent Comments