This solution is primarily tailored for holiday businesses or similar situations. It helps prevent emails from being sent, for example, when customers define a start date for their holiday, then abandon the site, and the current date has already passed the holiday's start date.
Before you start
You must ensure that a Start Date is captured against your Signals. You can verify this information in the Audit Logs for Visitor Records. For example, the following account captures an 'arrival_date' field:
If this is not being captured as required, contact Support.
Solution
Go to Automation > Triggers.
Select the Trigger Programs tab.
Select the trigger program you want to edit.
Under Advanced Features, select Edit script.
Copy and paste the code below into the script field:
function parseDate(dateString) {
if (dateString.includes("-")) {
var parts = dateString.split("-");
} else if (dateString.includes("/")) {
var parts = dateString.split("/");
} else {
return null;
}
if (parts[0].length === 4) {
return Date.parse(parts[0] + "-" + parts[1] + "-" + parts[2]);
} else {
return Date.parse(parts[2] + "-" + parts[1] + "-" + parts[0]);
}
}
result.proceed = false;
var currentDate = new Date();
var startDate = INSERT SIGNAL FIELD HERE;
// If signal field does not exist, startDate will be undefined
if (startDate) { // Check if startDate (signal field) exists
var formattedDate = new Date(parseDate(startDate));
if (formattedDate > currentDate) {
result.proceed = true;
} else {
result.proceed = false;
}
} else { // If startDate (signal field) does not exist (
undefined), set result.proceed to true
result.proceed = true;
}You must replace INSERT SIGNAL FIELD HERE on Line 19 with the
start_dateorholiday_datevariable you’re capturing. For example:cart.p[0].opt.arrival_datecart.p[0].opt.arrivalcart.p[0].opt.startcart.p[0].opt.start_date
The script only supports the following date formats:
YYYY-MM-DD
DD-MM-YYYY
YYYY/MM/DD
DD/MM/YYYY
Select Run to test the script to confirm its functionality for your account:
Select Save.
We advise that you then monitor the Audit Logs of your visitors over the next few days. To do this, you can check Browse/Cart Abandon Signals for visitors:
Go to Reports > All Reports.
Expand the Site Activity & Insight drop-down menu and select Browse and Cart Abandons.

