Expand my Community achievements bar.

Profile Scripts + Visitor Profiles

Avatar

Level 4

Hello,

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));

Thanks,

Brion

3 Replies

Avatar

Level 1

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

Avatar

Level 4

Hi,

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.

Thanks

Pranav

Avatar

Employee

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 :

<script>

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

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

</script>

Note : write your own profile script name