Last active
December 6, 2021 10:29
-
-
Save lukefrake/6e46b18c873a01095b5c2c028c56e9aa to your computer and use it in GitHub Desktop.
Google Optimize Mutually Exclusive Experiments with Customer Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use in the custom JavaScript section of Google Optimize to generate a group of buckets | |
// Change the %4 to %n to change the number of buckets | |
// Buckets are returned 0 index, so the following function will return 0, 1, 2 or 3 | |
function() { | |
var group = localStorage.getItem('optimizeTestGroup'); | |
if ( group ) return group | |
group = parseInt(ga.getAll()[0].get('clientId'))%4; | |
localStorage.setItem('optimizeTestGroup', group) | |
return group; | |
} |
How do you define which bucket an optimize experiment is in?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following GIF shows how to add this to Google Optimize.