DEV Community

Jona
Jona

Posted on

Mutually exclusive experiments in Google Optimize

siloing users

Introduction

One of the Achilles heels of Google optimize as an AB testing platform is how they bucket users into experiments. Users are often placed into multiple experiments at the same time without the possibility of natively having the users bucketed into only a single experiment at a time. In this post I will highlight an approach to ensure that experiments are mutually exclusive i.e. a user will only be placed in a single experiment at a time.

Siloing Your Users.

When a user visits your website, we execute the following steps:

  1. Check if the guest has already been siloed, if not proceed.
  2. Generate a random number between 1-100.
  3. Create a cookie and store the number generated in the previous step.
if(!window.vuCookies.get('vu.silo')) {
window.vuCookies.set('vu.silo', Math.floor(Math.random() * 100)+1, 365);
}
Enter fullscreen mode Exit fullscreen mode

*Note:

  1. The window.vuCookies is custom code.
  2. This code must be placed before the Google Optimize script.

Audience Targeting

Set the audience targeting condition on the experiment level.
Audience targeting

Audience targeting by cookie

siloing condition

Conclusion

In order to have accurate AB testing results its paramount that a user is not bucketed into multiple experiments. The approach outlined in this article will ensures tests remains mutually exclusive.

Top comments (0)