I want to target visitors who have been active i.e. surfing on my website during the last 48 hours.
How could this be achieved?
thanks
Nicolas
Topics help categorize Community content and increase your ability to discover relevant content.
@niocolasmeriel Given your case we can achieve this with profile scripting in Adobe target and consume the profile script variable in audience to target your activities.
Here the sample code for reference.
var dayInMillis = 24 * 60 * 60 * 1000; // Milliseconds in a day
var twoDaysInMillis = 2 * dayInMillis; // Milliseconds in two days
// Check if the user has a last activity time stored
if (user.getLocal('lastActivityTime')) {
var lastActivityTime = user.getLocal('lastActivityTime');
var currentTime = new Date().getTime();
// Calculate the time difference
var timeDifference = currentTime - lastActivityTime;
// Check if the time difference is less than or equal to two days
if (timeDifference <= twoDaysInMillis) {
return 'active';
} else {
return 'inactive';
}
} else {
// If no last activity time is stored, set the current time as the last activity time
user.setLocal('lastActivityTime', new Date().getTime());
return 'inactive';
}
Let me know if you need more assistance on this.
~cheers,
NN.
@niocolasmeriel , apart from the profile script option
may be it not if used with WebSDK or segments are based on the https://experienceleague.adobe.com/en/docs/analytics/components/real-time-reporting/realtime