Google Tag Manager User Reseller Custom Tag Template – News Couple

Google Tag Manager User Reseller Custom Tag Template

I have enjoyed working with Google Tag Manager custom templates. Much. So much so that whenever the need arises to add some custom code to a container, my first thought is how to turn that into a custom template.

Google has been steadily introducing new APIs, and I think a variety of things you can do with the model are getting better with each new API release.

In this article, I’ll show you how to use a simple tag template to allocate users into groups, based on a random split.

You can download and/or install the template here.


Simmer . Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava right in your inbox!

How it works

When creating a tag from the template, you have two options.

1. Distribution One

If you choose to create a file Not connected distribution, you are indicating the correct percentage value between 1 and 100 (inclusive). When the tag is triggered, the randomizer pulls a number in that range, and if the number falls in the range you provided, a cookie is called _gtm_group You will write the value "true".

single distribution

You can use this cookie to a sample Your visitors, for example, to keep your data collection below quotas or restrictions imposed by the platforms you use.

If the number does not fall into the distribution, the cookie is set with the value False. This is to ensure that a cookie is set only once per browser.

how to use

If you set this flag to activate with the All Pages launcher, all your users will be assigned to either a file real bucket or False Bucket. Then you can create a first-party cookie variant of _gtm_group like him:

First Party Cookie

You can check the value of this cookie in your triggers to ensure that your tags are activated only for those included in the set:

first-party cookie Equal true

Or, on the contrary, you can switch the value check to false To activate your tags only for those who have been “sampled”.

2. Multiple distribution

The Multiple The distribution allows you to create different files groups, where each group has a probability weight to include the user. You can add groups as rows in the table, where the file group value What is the _gtm_group will receive a cookie as a value, and distribution The weight percentage (out of 100) that you want to assign to the group.

multi distribution

The sum of the distributions must not exceed 100. The groups are processed from top to bottom, so if the sum of the distributions is more than 100, the groups at the end of the table will not get their distribution probabilities.

Total can Less than 100. It just means that there will be a probability distribution that doesn’t set the cookie at all.

For example, let’s say you have the following items:

group value distribution
monitoring 10
difference 1 20
difference 2 20
3 . difference 20
4 . difference 20

When the tag is activated, it randomly (implicitly) arranges an integer between 1 and 100. This number is then checked against the groups, starting at the top, and the distribution is calculated as increments until 100 is reached.

For example, if the random number is 15th. , are included in the set difference 1, because this set will contain values ​​between 11 And 30.

If the random number is 68, is included in the set 3 . difference, because this set will contain values ​​between 51 And 70.

If the random number is 93It is not included in any group and no cookie is set.

how to use

Similar to the single distribution, you can create a file First Party Cookie And use that to selectively activate tags based on which group the user belongs to. You can also use this to create distros for A/B testing, in case you want to control what kind of content will be shown to users in different groups.

by expanding Cookie settings group, you can change the details about the cookie that has been set.

Cookie settings

The default values ​​are:

cookie name: _gtm_group

Cookie domain: auto

Maximum cookie life (in days): 365

take auto In the cookie domain fields, GTM will attempt to write the cookie to the highest domain name in the hierarchy. So if the user is browsing, GTM will write a cookie

Note that if you change the cookie name, ** you must modify the permissions of the form to allow GTM to do so Read And write The name of the new cookie.

Cookie permissions


Hope you find this form useful. It’s not an exact science – the random distribution of numbers isn’t necessarily the most powerful thing in the world, and as with anything random, you need enough data to avoid outliers in the distribution.

But especially for sampling, it should be close enough to provide comfort.

Let me know in the comments if you have suggestions for improving the template!

Source link

Related Articles

Leave a Reply

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

Back to top button