It's Quiz4Y

[GTM utilization] 5 triggers you want to set

GTM (Google Tag Manager) is basically a convenient tool that allows you to add tags without editing the HTML of the page, but even if you install the tool, you cannot set it unless you know how to use it.
Therefore, this time, I have summarized the setting method and setting example of the trigger, which is especially in demand.

5 triggers you want to set

Triggers in GTM are for setting “conditions for delivering tags”.
It corresponds to the part of “to XX” when “I want to embed (deliver) a tag to XX”.
In other words, even if you have the tags you want to deliver, you cannot complete the tag registration unless you can set the essential trigger.
There are some patterns in the conditions for delivering tags. We will introduce 5 typical patterns in particular, so please refer to them.

1) Fire the tag only on a specific page

The most frequently set trigger is “on a specific page”.
For example, “on the product detail page” when “I want to put out a retargeting tag on the product detail page”, “on the purchase completion page” when “I want to put out a conversion tag on the purchase completion page”.Example of use・ I want to put out a retargeting tag “on the top page of the site”・ I want to put out a retargeting tag “on the product detail page”・ I want to put out a conversion tag “on the purchase completion page”

To set “specific page” as a trigger condition, use URL variables.
Because the page changes according to the URL, conversely, you can identify the page by showing the URL.Things necessary-“Page” variables (“Page URL” variables, “Page Hostname” variables, “Page Path” variables)-“Page view” trigger (= timing when the page is displayed)

There are three page-type variables that are prepared from the beginning as “built-in variables” in GTM.
A “Page URL” variable that indicates the full URL (excluding #), a “Page Hostname” variable that indicates only the domain name part, and a “Page” that indicates from “/” to “?” Or “#” immediately after the domain name. The Path variable.
If you want a variable that retrieves only the query (? ~~) part other than these three variables, you can use it by newly registering it as a “user-defined variable”.

 
Now, let’s take a concrete look at how to actually set the trigger.
This time, as an example, I will introduce the condition when the user sees “https://example.com/shopping/buy/complete.php”.
 
1. Click “Trigger” on the left menu to display the trigger list screen.

 
2. Click the red “New” button under “Trigger” to display the new trigger registration screen.

 
3. “Trigger settings” Click the area to select the type of trigger you want to register, so select “Page view” in “Page view”

 
4. Select “Some page views” in “Location of this trigger” and enter the condition Show

 
5. “all of these at the time of the event conditions will deliver this trigger in the case of a true” by entering the following conditions at the point of, click the “Save” button in the upper right corner
· {{Page URL}} [Includes] [example.com/shopping/buy/complete.php]

 
6. “Change trigger name” is displayed. Enter an arbitrary name (example: “Page-Purchase completion page”) and click the “Save” button to complete

. Conditions using the “Page URL” variable. When making, the point is to “set only the fixed part” to “do not use” equal “as much as possible”.
This is because URLs have fixed parts such as domain names and paths, and variable parts such as http (or https) and queries (? ~~). The “equal” available in the trigger condition indicates an exact match, which makes it difficult to handle.
For example, if “https://example.com/shopping/buy/complete.php” is set to “equal”, it will not match the case of “http: // ~~”. Also, if a query such as “? TransactionId = 123456” is added to the end of the URL, it will not match because it will not match exactly.
Considering all these things, it is safer to avoid “equal” as much as possible.
The above is an example of using the “Page URL” variable as one condition, but there is also a method of setting with two conditions using the “Page Hostname” variable and the “Page Path” variable.
Since these two variables do not blur, it is easy to use “equal” and “match at the beginning”.Condition setting example of “https://example.com/shopping/buy/complete.php”[When setting only with the “Page URL” variable]· {{Page URL}} [Includes] [example.com/shopping/buy/complete.php][When setting with “Page Hostname” variable and “Page Path” variable]· {{Page Hostname}} [equal] [example.com]・ {{Page Path}} [equal] [/shopping/buy/complete.php]

If the URL can be set in either case, please set it as you like.
On the other hand, if you want to use “equal” or “match at the beginning”, it is recommended to divide the settings into multiple conditions as in the latter case.

2) Ignite the tag only with a PC / smartphone

For example, if the URL is different between the page for PC and the page for smartphone, you can distinguish the conditions of PC / smartphone by using the URL as a condition as in (1), but the URL of the page does not change between PC and smartphone. In that case, it cannot be determined by the URL.
In such cases, it is simplest to use the browser user agent to make the determination.
 What is a user agent? 
This is the “detailed name of the browser” that the browser has.
For example, for Windows Chrome (version 70), “Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 70.0.3538.102 Safari / 537.36” is the user agent.

If it is a general browser, the user agent will include “browser name”, “OS”, “version”, etc.
Also, if it is a browser for smartphones, either “iOS”, “Android” or “Mobile” is included, so by using this as a condition, “whether it is a smartphone or not a smartphone (= PC)” Can be determined.
 Things necessary-Variable to get “browser user agent” (JavaScript variable)-“Page view” trigger (= timing when the page is displayed)

The browser user agent is not initially provided as a “built-in variable” in GTM.
However, since it can be obtained with JavaScript, it can be easily referenced by registering it as a variable.
1. Click “Variables” on the left menu to display the variable list screen.
 
2. Click the red “New” button under “User-defined variables” to display the new variable registration screen.

 
3. “Variables” Click the “Settings” area to select the type of variable you want to register, so select “JavaScript Variable” in “Page Variables”
 
4. Enter “navigator.userAgent” in “Global Variable Name” and click “Save” in the upper right. Click the button

 
5. “Rename variable” is displayed. Enter an arbitrary name (example: “navigator.userAgent”) and click the “Save” button to complete.

Variables for the user agent of the browser. Now available as.
All you have to do is incorporate it as a trigger condition.
 
6. Display the trigger new registration screen
 
7. Select “Some page views” and fill in the condition input field Display, enter the following conditions, and click the “Save” button in the upper right.
{{(Variable name registered in [5])}} [Match regular expression (ignore case)] [ (ios | android | mobile)]

 
8. “Change Trigger Name” will be displayed. Enter any name (example: “All Pages-Smartphone”) and click the “Save” button to complete. The

above is all pages for “Smartphone”. It becomes a trigger that reacts with.
Similarly, let’s prepare a trigger for “PC” this time.
 
9. Display the trigger new registration screen and select “Page view”
 
10. Select “Some page views” and fill in the condition input field Display, enter the following conditions, and click the “Save” button on the upper right.-
{{(Variable name registered in [5])}} [Does not match regular expression (ignore case difference)] [(ios | android | mobile)]

 
11. “Change trigger name” is displayed. Enter an arbitrary name (example: “All Pages-PC”) and click the “Save” button to complete the

point. The point is that the condition is reversed just by changing the part that was “matching” in the trigger condition for smartphone to “not matching”.
In other words, the theory is that it is not a smartphone = a PC.
In addition, it is possible to add multiple conditions to be set by the trigger.
For example, if you want to make a trigger such as “If it is a” smartphone “and a” product detail page “”, you can handle it by adding a condition using the “Page URL” variable etc. in the trigger.
As a caveat, “If there are multiple conditions in one trigger, it will be” AND condition (matches only when all are satisfied) “”, but on the tag side, “Multiple triggers are linked as tag delivery triggers. If it is, it will be “OR condition (delivered only if any one trigger is met)”.
The behavior itself is very different, so you need to be careful.
 

3) Fire the tag depending on the viewing status of YouTube videos

Nowadays, I often see pages that post YouTube videos. This is good because videos are more informative than text and still images and can be said to be content that benefits users.
However, when posting a video, in general, it is often necessary for the user to perform an operation such as one click to play the video, and this “one action is required” is a hurdle for the user to play the video. There are many cases.
However, conversely, it also means “user who played the video” = “user who executed it even if there was a hurdle”. In other words, users who play videos are of higher quality as potential customers than users who do not play videos. This is especially true for users who have played to the end.
Therefore, we often hear the demand for advertising tags to users who have taken actions related to videos.Example of use・ I want to put out a retargeting tag to users who have “played a video”・ I want to issue a retargeting tag to users who have “completed playing the video to the end”

If you are using the official YouTube “embed video” function when posting a video, you can easily register it as a trigger from GTM.
Please note that if you customize the video with JavaScript etc. and post the video, it will be difficult to trigger with GTM.

 Things necessary-The method of posting the video in HTML is the official YouTube “embed video”.・ “YouTube video” trigger (= timing when YouTube video is operated)

If the content is simply “YouTube video has been played” or “YouTube video has been played”, you can register the trigger without registering any variables.
The following is the method when setting “timing when the video is played” as a trigger.
 
1. Display the new trigger registration screen and select “YouTube video” in “User engagement” for “Trigger type”

 
2. “Capture” Uncheck “Done” in the section and change to the state where only “Start” is checked.

 
3. Check “Add JavaScript API support to all YouTube videos” in “Advanced” and “Save” in the upper right. Click the “” button

 
4. “Change trigger name” is displayed. Enter an arbitrary name (example: “Video-Start”) and click the “Save” button to complete. In

the “Capture” column of the trigger. Each item is the setting of how to react this trigger when the YouTube video is operated.
In the above case, only “Start” is checked, so this trigger will react when the video is played.
Similarly, let’s register “when the video has finished playing” as a trigger this time.
 
5. Display the new trigger registration screen and select the “YouTube video” trigger as in [1].
 
6. In the “Capture” section, uncheck “Start”, change to the state where only “Done” is checked, and check “Add JavaScript API support to all YouTube videos” as in [3].

 
7. Name the trigger from the “Save” button (example: “Video-Complete”) and save.

Since the “Capture” field is a check box, set multiple timings with one trigger. Is also possible. However, in that case, for example, a trigger that checks two places, “Start” and “Done”, will react at both timings, but since it is the same trigger, different tags will be issued for “Start” and “Done”. can not.
Therefore, if you want to put out an ad tag, it is better to separate it into “start” and “complete” and register it as a separate trigger.
 More advanced usage-If you want to trigger “when played to a certain stage”, you can do so by setting the “capture” field to “progress”.・ If you want to measure events with Google Analytics instead of ad tags, it is recommended to check multiple “Capture” fields and combine them into one trigger. After that, it is recommended to enable the “Video URL” variable and “Video Status” variable, which are built-in variables, and refer to each item of event measurement for measurement.

If the video is uploaded to YouTube, you can see more detailed analysis data by using YouTube analytics provided by YouTube.
If you want to know the status of the video from an analytical point of view, it is better to refer to that as well.

4) Fire the tag depending on the browsing status of the page

The page read rate is one of the indicators you care about.
Especially in recent years when smartphones have become widespread, the vertical length of pages tends to increase, and on reading pages such as articles and product detail pages with a large amount of important information, “users who returned immediately after displaying the page” and “pages” “Users who scrolled to the middle of (≒ read the page properly)” can be called exceptional in terms of importance.
 Example of use・ I want to put out a retargeting tag when I read an article halfway.・ I want to put out a retargeting tag when “scrolling to some extent in the product details”

It’s similar to what’s called a heatmap, but GTM also allows you to register triggers that react “according to the amount of scrolling the page”.
 Things necessary-“Scroll distance” trigger (= timing when the specified ratio page is scrolled)

 
1. Display the new trigger registration screen and select “Scroll distance” in “User engagement” for “Trigger type”

 
2. “Vertical direction” Check “Scroll” and confirm that “Ratio” is selected.

 
3. Enter the desired percentage in the “Ratio” input field (example: “50”) and click the “Save” button on the upper right. Click

 
4. “Change Trigger Name” will be displayed. Enter an arbitrary name (example: “Scroll-50”) and click the “Save” button to complete. The

above is “Page on all pages in the site.” Will trigger a “react” when is scrolled 50%.
The point is that the part entered in “Ratio” in [3] is a field for setting “How much you want to react when scrolling”. By changing the value here, you can, for example, scroll even a little (such as “25”) or scroll to the end of the page (such as “90”).
In the “Ratio” input field, you can specify multiple ratios separated by “,”, but as in (3) above, if you specify multiple ratios with one trigger, each ratio will be different. I can’t separate the tags.
Therefore, if you still want to put out an ad tag, we recommend that you register it as a separate trigger for each percentage.
Also, for example, it doesn’t make much sense to look at the read rate of site map pages, so in particular, the trigger for “page read rate” should be limited to “article page” and “product detail page”. It is effective to “limit the page”.
If you want to narrow down the target pages like this, you can set the conditions using variables by selecting “Some pages” in “Location of this trigger”, so “Page URL” as in (1) It’s a good idea to add conditions for variables and “Page Path” variables.

 More advanced usageIf you want to react to “when a specific block in the page is displayed” instead of “scrolling the percentage of the entire page”, use the “Show Element” trigger instead of the “Scroll Distance” trigger. In the “Display element” trigger, specify the target block by the value of the id attribute (“xxxx” part of “<div id =” xxxx “>”) and set it.

5) Fire the tag depending on the time spent on the page

Similar to “page scrolling rate”, there is “page dwell time”.
The scroll rate can be used mainly as an index of “page read rate”, but it can be a more diverse index in the case of staying time.
What happens when a user is “loading a page slowly” is an act that involves time in addition to scrolling the page. Rather, “stay time” is more effective than “scroll rate”, especially for pages with a large amount of information per screen.
In addition to that, for example, it tends to take time even when you are worried, so it can be used as an index for judging that it is taking time = the user is at a loss (such as purchasing a product).
 Example of use・ I want to put out a retargeting tag as a user who is deeply considering “when staying on the page for a certain period of time on the product introduction page”・ I want to put out guidance content such as “Are you in trouble?” As a user who is lost when “when you stay for a certain period of time on the service introduction page”.

You can easily register a trigger that says that a certain amount of time has passed since the page was displayed in GTM.
Considering the role of the trigger, it is meaningless to implement it on all pages in the site, so it is a basic usage to set the target page as a condition at the same time.
 Things necessary-“Page” variables (“Page URL” variables, “Page Hostname” variables, “Page Path” variables)・ “Timer” trigger (= timing when a certain time has passed after the page is displayed)

1. Display the new trigger registration screen and select “Timer” in “Other” for “Trigger type”.

 
2. Hope to “Interval” Enter the number of seconds (milliseconds) of, and enter “1” in “Limit”

 
3. Specify the page in the “Enable this trigger when all these conditions are true” section as in (1) Enter the conditions to be used and click the “Save” button on the upper right.

 
4. “Change Trigger Name” will be displayed. Enter any name (example: “Timer-OO pages-OO seconds”). When you click the “Save” button to complete the

setting, note that the number of seconds specified in [2] is in milliseconds. Milliseconds = 1/1000 seconds, so if you enter 1000, it will be 1 second.
Also, if you forget to enter “1” in “Limit”, the tag will appear over and over again every time the time entered in “Interval” elapses. Therefore, be sure to set the “restriction” part.
The part [3] is the field for setting the “specify page” condition.
As with other triggers, refer to (1) and set the conditions for specifying an arbitrary page with the “Page URL” variable.
 More advanced usageIf you want to trigger “time spent with a specific block displayed” instead of “time spent” on the entire page, use the “display element” trigger instead of the “timer” trigger. After specifying the target block with the “Display element” trigger, set the “Minimum ratio of visual recognition” column to a small number such as “10”, check “Set the minimum display time on the screen”, and click “Timer”. Set the time in milliseconds, similar to the trigger.

Bonus: Download setting sample

We have prepared a setting sample that sets each of the contents introduced in this article.
You can copy the contents by downloading this and “importing” from the management screen of the container you want to use. You can use it as it is by rewriting a part, so please use it.
 Download configuration sample

Import method

1. Download the above file, unzip it, and extract the .json file inside.
 
2. Open the GTM container you want to use and click “Manage” from the menu at the top of the screen to display the management screen.

 
3. “Container settings” Click

 
“Import Container” 4. Specify the downloaded file in “Select File to Import”

 
5. Select “New” for “Select Workspace”, add an arbitrary “Workspace Name”, and select “Workspace Name” in the upper right. Click the “Save” button

 
6. Select “Integrate” in “Select Import Options” and select “Overwrite Conflicting Tags, Triggers, Variables.”

 
7. Click the “Confirm” button to complete
 
. The contents cannot be used as they are, so please rewrite the necessary parts.Where you need to change-URL of the condition column of each trigger (when indicating “specific page”)

For details, please refer to the “memo” at the bottom of the screen for each element.
This time, we have summarized the triggers that are frequently registered.
It’s been a bit long, but you don’t have to understand it all at once.
If you are not sure, try importing the download file posted at the end for the time being, and I think that it will be a little easier to understand if you play with it referring to the memo column.
In addition, the following articles also introduce triggers such as “when a link leaked to an external site is clicked” and “when a file download link is clicked”, so please refer to that as well.

Leave a Reply

Your email address will not be published. Required fields are marked *