In this tutorial, you will learn how you can use different timelines paired with your registration page based on the day of the week when visiting your page.
Why would you want to do this?
You may have a presentation that differs on weekends.
You might want to customize the event timeline for each day of the week.
Perhaps every Friday, your event features a "Special Friday" presentation.
Regardless of your specific needs, by the end of this tutorial, you'll have a clear understanding of how to use a simple JavaScript snippet to dynamically choose and display different timelines based on the day of the week.
Steps to defining and installing special Java Script Registration Header.
First we must decide which timelines we want to use for what day.
In our example, we want to run a different timeline and presentation on Saturday and Sunday, than Monday - Friday. However, our script below supports a different timeline for each day of the week if you desire.
My Saturday - Sunday WTL is: NuJHrX9zzLOQBHj
My Monday - Friday WTL is: g7COokoAHbpPa0Z
(need some help locating your "WTL"?)
The week starts on Sunday and ends on Saturday, day 0 "case 0" will be NuJHrX9zzLOQBHj, as well as Saturday being day 6, "case 6". The rest of the week I will make g7COokoAHbpPa0Z. I will also make the default, g7COokoAHbpPa0Z.
Copying the script below, I will swap out the XXXXXXXXXXX values for the day relation as mentioned above.
Next, we need to define our 'Tenant ID' in the script. (That was automatically sent to you upon visiting this tutorial.
Currently, the script below has tenantid = “XXXXXXXX”; and we need to swap that out with our tenant ID.
After customizing the Java Script for you to use, it's time to install it on your Registration Page.
Need help? Please refer to our Page Builder tutorials here.
After setting up your registration page with the customized header script, it's time to schedule your timelines as you want them to run, AND test!
Need any help? Please don't hesitate to hit that messenger button!
JavaScript:
<script>
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i < vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
var tenantid = “XXXXXXXX”;
var wtl = getQueryVariable("wtl");
if (wtl != false){
var timeline = wtl;
} else {
var date = new Date();
switch(date.getDay()){
//0 is Sunday - 6 is Saturday
case 0: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 1: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 2: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 3: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 4: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 5: var timeline = "XXXXXXXXXXXXXXXX"; break;
case 6: var timeline = "XXXXXXXXXXXXXXXX"; break;
default: var timeline = "XXXXXXXXXXXXXXXX"; break;
}
}
<!-- Begin AEvent Registration Page Code -->
<script defer type="application/javascript" src="https://" + tenantid + ".aevent.online/getscript?page=registration&wtl=" + timeline +”” ></script>
<!-- END AEvent Registration Page Code -->