Tuesday, November 21, 2023
HomeWeb AnalysisGoogle Analytics/Google Tag Manager templates released to the public!

Google Analytics/Google Tag Manager templates released to the public!

I think there are many people who want to quickly introduce Google Analytics when launching a new site. Nonetheless, if you only use the bare minimum to implement Google Analytics, you will end up suffering from referrer spam later on, and you will only be able to use default reports, and you will not be able to demonstrate the original power of Google Analytics. It will end up.

Therefore, based on the experience and knowledge that I have cultivated from my own experience of introducing Google Analytics / Google Tag Manager, I created a template for “tracking that cannot be done simply by installing GA tags” in a general form.

What can you do with this template

By using this template, in addition to sending simple page views, Google Tag Manager with the following customizations is automatically generated. Then, by changing only the parts that need to be changed according to the site, you can immediately use it on your own site.

  • Increase site speed sampling level from 1% to 100% (actual sampling level is around 10%)
  • Set the “client ID” used by Google Analytics to identify users as a custom dimension
  • Set “Session ID”, which has a unique value for each session, as a custom dimension
  • Set ‘timestamp’ as a custom dimension when sending hits
  • Perform event tracking for general click events such as phone number link clicks, external link clicks, file download link clicks, etc.
  • Execute social event on action of default social button (Facebook/Twitter)
    • This template supports only official Facebook/Twitter plugins. Unofficial customized social tags are not supported.
  • Notify Google Analytics of an error event when a browser-side JavaScript error occurs
  • Preparing dozens of custom user-defined variables including device type, user agent, etc.
  • Realize the following by internally using “Power Analytics”, which is a separate product
    • Set IP Address in Custom Dimension
    • Converts sources and media into easy-to-analyze content

Client ID, Session ID, and Timestamp can be set as custom dimensions, so you can uniquely identify a user or session and check the history of pages viewed by that user. In addition, since tracking of phone numbers, external links, file downloads, and social buttons is supported by default, additional customization is not required for basic event-based processing. In addition, since it is linked by default with “Power Analytics”, a Google Analytics plug-in developed by me, you can set the IP address of the viewing user as a custom dimension and automatically rewrite the referrer/media. ( Learn more about Power Analytics here ).

Conditions under which this template can be applied

The template is created on the assumption that Google Tag Manager / Google Analytics will be newly installed on a site that has not been installed. It is possible to install it by replacing the existing Google Analytics / Google Tag Manager, but after understanding that continuity with past data will be lost, make sure there are no errors in other settings of the existing Google Tag Manager. It is necessary to check and use it. Therefore, if you use it as a replacement for your existing Google Analytics/Google Tag Manager, please consider it for advanced users.

How to Use

The following is a summary of the minimum settings that are considered necessary to use this template. Knowing what you are doing within Google Tag Manager, you can make individual customizations.

How to import to Google Tag Manager

For more information on Tag Manager’s export and import functions , please refer to Google Tag Manager Official Help – Exporting and Importing Containers . Import the obtained template file (JSON format) from the tag manager template download link at the end of this article into the container where you want to configure Google Tag Manager.

Google Tag Manager settings

After importing, you’ll need to change some settings in Google Tag Manager to match your site’s structure. The setting items are as follows.

  • Variable: Google Analytics Tracking ID
    • Set the Google Analytics tracking ID you want to measure.
    • In order not to mix the measurements of the production site and the staging site, we use a lookup table, but if necessary, you can select “constant” in “select type” to set a fixed value.
  • Variable: UA – CustomDimensionIndex – Client ID
  • Variable: UA – CustomDimensionIndex – Referrer Spam Block
  • Variable: UA – CustomDimensionIndex – Session ID
  • Variable: UA – CustomDimensionIndex – Timestamp
  • Variable: UA – CustomDimensionIndex – IPAddress
    • Please set the index of the custom dimension that stores the corresponding data respectively.
    • Set “0” for unused custom dimensions

All the items that need to be changed are put in the folder “Need Fix”, so please make changes in the folder “Need Fix”.

Settings for Google Analytics

Some items, including custom dimensions, need to be changed on the Google Analytics management screen. We will describe the necessary changes other than the basic settings of Google Analytics and the reference page for making those changes, so please refer to these.

operation check

After completing the above settings, use Google Tag Manager’s preview mode to check the status of Google Analytics data transmission. Please check that it is correctly sent on the debug screen in preview mode, that it is reflected in the real-time report of Google Analytics, and that it is reflected in the normal report after a few hours. In addition to page views, event data transmission and social actions are also measured, so it is a good idea to check whether they are being measured correctly.

For more advanced tracking

This template makes it easy to incorporate some of the advanced tracking. However, there are many trackings that were difficult to implement generically and could not be included in the template.

If you want to do more advanced tracking, we recommend that you use this template and further observe the user’s actions on the site in detail to identify the points that should be measured.


We introduced a template for taking the measurement a step above the default tracking code implementation. If you know of a customization example that says, “This template doesn’t do it, but it would be nice to do something like this!”


Leave a reply

Please enter your comment!
Please enter your name here

Recent Posts

Popular Posts

Most Popular

Recent Comments