Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new

Learn more

View all

Sign in to view all badges

Profile Scripts + Visitor Profiles

Level 4
Level 4


Our dev team encountered an issue recently where an audience we created to track the number of days from the current day has stopped working. For example, if I chose to book at trip for 3/23, I'd be counting 10 days from today, and would subsequently be placed within a 0 - 10 audience segment. However, we have several audiences that utilize this profile script, that are now grossly under-reporting data.

As mentioned, the following script has worked for months, and suddenly has stopped. When I put it in Console, I get an "Illegal return statement" error message.

While I didn't write this, can anyone tell if there's a problem with this script, or determine if something larger is the issue?

//Grab the check-in day and month

var taoCheckInDay = page.param('qCiD'),

     taoCheckInMonth = page.param('qCiMy');

// Change check-in month and day into a Date object

var taoCheckInYear = taoCheckInMonth.substring(2, 6); // Creates something like 2016

var taoCheckInMonth = taoCheckInMonth.substring(0, 2); // Should now just be 00 through 11

var taoCheckInDate = new Date(taoCheckInYear, taoCheckInMonth, taoCheckInDay);

var taoToday = new Date();

// Take those dates and determine how far away is the check-in date

return Math.round((taoCheckInDate - taoToday) / (1000 * 60 * 60 * 24));



3 Replies
Level 1
Level 1

The profile Script code won't execute in the console. Either use mboxtrace method or activate the campaign with some QA audience.

Level 4
Level 4


Profile scripts run server side and hence in the console you will never be able to execute.

You can debug profile script through response tokens or through mbox Trace.

Detail you can find at below supporting doc under Debug Profile Script:

Profile Attributes

Hope this helps.



Level 4
Level 4

You can even display the profile scripts value in console but only from your offer code implemented through the Activity.

Just use the below syntax in your offer code :


  var ProfileScript = '${user.profilescriptname}';

  console.log('profile script:',ProfileScript );


Note : write your own profile script name