Running an Experience during a scheduled time period

Introduction

Convert lets you schedule your experiments or campaigns to start and stop them at specific times. 

Tip

Add Moment.js Library

First, you will need to include the moment.js library into your project. You can do this by adding the following line into the Global Project Javascript:


convert.$.getScript("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.3/moment.min.js", function(){

  console.log("moment.js has been included.");

});

It will look like this:

mceclip0.png

Add JS Condition on Audiences

Now include the following code as a Javascript Condition on your Audience, replacing the date and time shown in bold below with the specific date(s) and time(s) you are targetting:

(function() {
	if (typeof moment == 'undefined') {
		convert_recheck_experiment();
	} else {
		return moment().isBetween('2018-01-12 00:00:01', '2018-01-15 23:59:59');
	}
})()

It will look similar to the screenshot below:

mceclip0.png

Moment will interpret the date as the user's local computer time, but if you want to specify a time zone or UTC offset or do anything more complex, please refer to the official documentation:

https://momentjs.com/guides/

http://momentjs.com/docs/

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments