AB test for specific time duration during a day daily

147 views Asked by At

Is it possible to run ab test for specific time daily,

eg. if i want to run ab test during day time only daily how can i do it?

case test will run during 9:00am to 9:00pm US timezone daily

1

There are 1 answers

1
Thiago Guimarães On

Yes, is it possible to run ab test for specific time daily.

Example: Target visitors browsing your site in the morning You want to target experiments to users visiting your site during the morning hours. To do this, write a JavaScript function that returns the current hour (with possible values 0-23). Then, create a targeting condition that looks for a returned value that is less than 12.

Step 1: Create a custom variable Create or edit an experiment. Click the TARGETING tab. Click AND to add a new targeting rule. Click Custom JavaScript. Click Variable, then Create new... Optionally, click an existing variable to edit it. Enter your Custom JavaScript in the open text field (see a sample below). Name your variable – for example, Browser time. Click CREATE VARIABLE. Sample JavaScript which returns the time that the browser’s clock is set to:

function() {
  return (new Date()).getHours();
}

Step 2: Build a condition with your custom variable After creating your custom variable, Optimize will populate it in a new targeting condition which you can complete by adding a match type and value. For this example, build a targeting condition that looks for a returned value of 11 or less and click SAVE.

Variable Match type Value
Browser time less than 12

This condition will evaluate true if:

the value of the Browser time variable is less than 12. This condition will evaluate false if:

the value of the Browser time variable is 12 or greater.

Refecences: https://support.google.com/optimize/answer/6301785?hl=en#zippy=%2Cin-this-article