Skip to content

Greeting visitor based upon time

In Aliveforms, JavaScript API Can be used to greet visitor based upon time. Check this example Greeting visitor based upon time.

Setup

Logic For Screen -1 or __boot(){}

Execute JavaScript | -1
var myDate = new Date();
var hrs = myDate.getHours();

var greet;

if (hrs < 12)
    greet = 'Good Morning!';
else if (hrs >= 12 && hrs <= 17)
    greet = 'Good Afternoon!';
else if (hrs >= 17 && hrs <= 24)
     greet = 'Good Evening!';

$.Var('GREET', greet);