You are here

GTM Dice Triggers

description

Let's roll a 100 sided dice and trigger the tags you want in Google Tag Manager. This GTM module allows to cover a specific percentage of your pageviews and users.

In role playing games if you roll a low number on your two d10 you get more tags in GTM.

Super simple, this santiano.io Module can be used to deploy some tags on a specific percentage which can be super useful on let's say a Analytic Tool that has a limited number of hits you can send ;)

Implementation examples :

  • You want to integrate the pageLoadPerformance on 30% of your 'window loaded' ?
  • You don't want to integrate the Hotjar Tag on all your users but on a few only

This module is 100% standalone, which means you can merge this with your current GTM config and use these triggers as you want...

setup

Please refer to the container setup instructions

gtm tags

userCookieDice100 - Cookie Drop

userCookieDice100 - Cookie Drop
Tag Type : Custom HTML
Drops by default a 10 day Dice Cookie on the user

  <script>
// conditional variables :
var randomNumber = {{randomNumber0-99}};
var userCookieDice100 = {{userCookieDice100}};

// Function for that Cookie creation
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

// very simple behavior :
// I don't have the cookie, I drop it
// I have the cookie, I do nothing
// And I store the value of the randomNumber I get in that cookie

// First Page I drop the Cookie.
// Second Page the cookieDice triggers are operational :)

if ( userCookieDice100 == undefined ) {

	// I don't have a cookie for that user yet
	// Cookie Name
	var cookieName = "userCookieDice100";
	// Cookie Value
	var cookieValue = randomNumber;
	// Cookie length in days : 10 days is largely enough
	var cookieDays = "10";
	// I drop the cookie
	createCookie(cookieName, cookieValue, cookieDays);
} // end of IF Statement

</script>
close

gtm triggers

All PageViews - 10 percent Audience

All PageViews - 10 percent Audience
Trigger Type : Page View
This triggers on 10% of all your users
userCookieDice100 is less than 10

close
All PageViews - 20 percent Audience

All PageViews - 20 percent Audience
Trigger Type : Page View
This triggers on 20% of all your users
userCookieDice100 is less than 20

close
All PageViews - 30 percent Audience

All PageViews - 30 percent Audience
Trigger Type : Page View
Triggers on 30% of your audience
userCookieDice100 is less than 30

close
All PageViews - 40 percent Audience

All PageViews - 40 percent Audience
Trigger Type : Page View
Triggers on 40% of your audience
userCookieDice100 is less than 40

close
All PageViews - 50 percent Audience

All PageViews - 50 percent Audience
Trigger Type : Page View
Triggers on 50% of your audience
userCookieDice100 is less than 50

close
All PageViews - 60 percent Audience

All PageViews - 60 percent Audience
Trigger Type : Page View
TRiggers on 60% of your audience
userCookieDice100 is less than 60

close
All PageViews - 70 percent Audience

All PageViews - 70 percent Audience
Trigger Type : Page View
Triggers on 70% on your audience
userCookieDice100 is less than 70

close
All PageViews - 80 percent Audience

All PageViews - 80 percent Audience
Trigger Type : Page View
Triggers on 80% of your audience
userCookieDice100 is less than 80

close
All PageViews - 90 percent Audience

All PageViews - 90 percent Audience
Trigger Type : Page View
Triggers on 90% of your audience
userCookieDice100 is less than 90

close
DOM Ready - 10 percent

DOM Ready - 10 percent
Trigger Type : DOM Ready
10% only of the dom ready event
randomNumber0-99 is less than 10

close
DOM Ready - 20 percent

DOM Ready - 20 percent
Trigger Type : DOM Ready
20% of your dom ready events
randomNumber0-99 is less than 20

close
DOM Ready - 30 percent

DOM Ready - 30 percent
Trigger Type : DOM Ready
30% of your dom ready events
randomNumber0-99 is less than 30

close
DOM Ready - 40 percent

DOM Ready - 40 percent
Trigger Type : DOM Ready
40% of your dom ready events
randomNumber0-99 is less than 40

close
DOM Ready - 50 percent

DOM Ready - 50 percent
Trigger Type : DOM Ready
50% of your dom ready events
randomNumber0-99 is less than 30

close
DOM Ready - 60 percent

DOM Ready - 60 percent
Trigger Type : DOM Ready
60% of your dom ready events
randomNumber0-99 is less than 60

close
DOM Ready - 70 percent

DOM Ready - 70 percent
Trigger Type : DOM Ready
70% of your dom ready events
randomNumber0-99 is less than 70

close
DOM Ready - 80 percent

DOM Ready - 80 percent
Trigger Type : DOM Ready
80% of your dom ready events
randomNumber0-99 is less than 80

close
DOM Ready - 90 percent

DOM Ready - 90 percent
Trigger Type : DOM Ready
90% of your dom ready events
randomNumber0-99 is less than 90

close
PageView - 10 percent

PageView - 10 percent
Trigger Type : Page View
10% of all pageviews
randomNumber0-99 is less than 10

close
PageView - 20 percent

PageView - 20 percent
Trigger Type : Page View
20% of your pageview Events
randomNumber0-99 is less than 20

close
PageView - 30 percent

PageView - 30 percent
Trigger Type : Page View
30% of all your pageview events
randomNumber0-99 is less than 20

close
PageView - 40 percent

PageView - 40 percent
Trigger Type : Page View
40% of all your pageview events
randomNumber0-99 is less than 40

close
PageView - 50 percent

PageView - 50 percent
Trigger Type : Page View
50% of all your pageview events
randomNumber0-99 is less than 50

close
PageView - 60 percent

PageView - 60 percent
Trigger Type : Page View
60% of all your pageview events
randomNumber0-9 is less than 60

close
PageView - 70 percent

PageView - 70 percent
Trigger Type : Page View
70% of the pageview events
randomNumber0-99 is less than 70

close
PageView - 80 percent

PageView - 80 percent
Trigger Type : Page View
80% of your pageview eventss
randomNumber0-99 is less than 80

close
PageView - 90 percent

PageView - 90 percent
Trigger Type : Page View
90% of your audience
randomNumber0-99 is less than 90

close
Window Loaded - 10 percent

Window Loaded - 10 percent
Trigger Type : Window Loaded
10% of the Window Loaded Event
randomNumber0-99 is less than 10

close
Window Loaded - 20 percent

Window Loaded - 20 percent
Trigger Type : Window Loaded
20% of the window loaded in GTM
randomNumber0-99 is less than 20

close
Window Loaded - 30 percent

Window Loaded - 30 percent
Trigger Type : Window Loaded
30 of your Window loaded events
randomNumber0-99 is less than 30

close
Window Loaded - 40 percent

Window Loaded - 40 percent
Trigger Type : Window Loaded
40% of the window loaded
randomNumber0-99 is less than 40

close
Window Loaded - 50 percent

Window Loaded - 50 percent
Trigger Type : Window Loaded
50% of the window loaded events
randomNumber0-99 is less than 50

close
Window Loaded - 60 percent

Window Loaded - 60 percent
Trigger Type : Window Loaded
60% of the window loaded events
randomNumber0-99 is less than 60

close
Window Loaded - 70 percent

Window Loaded - 70 percent
Trigger Type : Window Loaded
70% of the Window Loaded events
randomNumber0-99 is less than 70

close
Window Loaded - 80 percent

Window Loaded - 80 percent
Trigger Type : Window Loaded
80% of the window loaded events
randomNumber0-99 is less than 80

close
Window Loaded - 90 percent

Window Loaded - 90 percent
Trigger Type : Window Loaded
90% of the window loaded Events
randomNumber0-99 is less than 90

close

gtm variables

randomNumber0-99

randomNumber0-99
Variable Type : Custom Javascript
Provides for every event in GTM a random number between 0 and 99

  // returns a number between 0 and 99
function() {
  return Math.floor((Math.random() * 100));
}
close
userCookieDice100

userCookieDice100
Variable Type : 1st Party Cookie
userCookieDice100

  The cookie that will store the random number 
close

Add comment

Download