Expand my Community achievements bar.

is there a way to target the last 48 hours?

Avatar

Employee

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

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor

@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.

Avatar

Level 7

@niocolasmeriel  , apart from the profile script option

  • consider creating a segment using Adobe Analytics where you can create sections for specific pages/visit/visit and apply time constraint: occurs within the last 48 hours as a condition
  • bring in conditional segments from AEP or Audience Manger 

Avatar

Level 3

@Rite18 I thought Adobe Analytics had some kind of delay though?