The User Distributor custom tag template is a tag template for Google Tag Manager’s community template gallery.

Blog post
Gallery entry
GitHub repo


You can use this tag to randomly assign users to buckets, and then to store this information in a first-party cookie. This is useful for quick A/B tests and for creating samples or cohorts of your visitors.


The tag has two modes: single and multi.

In single mode, you assign a percentage, and a random number will test if the user falls within this percentage. If they do, a cookie is assigned to them with the value true. If they do not fall into the sample, the cookie will be set with the value false. This can be used to, for example, sample only a percentage of your visitors.

In multi mode, you can create multiple groups and randomly assign the user to one of them. The total of all propabilities should be no more than 100. If it’s 100, then every user will fall into one of the groups and get the cookie assigned accordingly. If the total is less than 100, then users who do not fall into any of the groups will not have the cookie set, and they will be re-evaluated the next time the tag fires.

You can read more about the template from the associated blog post.

Release notes

Date Changeset
7 June 2020 Fix bug with permissions.
30 November 2019 Add unit tests.
2 October 2019 Update brand name.
20 September 2019 Initial release.