Hi simonb23491113,
Since Adobe Target doesnt have any notion of Visits, you can use proxy of 30 mins since your target page visited. In that case, following code can help:
if (page.url != "") {
if (page.url.indexOf("<provide some rule here>") >-1) {
user.setLocal('last_time_page_visited', new Date().getTime()); //Reset the time when your target page is visited
}
}
var minutesInMillis = 1000 * 60
var last_time_page_visited = user.getLocal('last_time_page_visited');
if (last_time_page_visited) {
var time_since_last_visit = ((new Date()).getTime()-last_time_page_visited)/dayInMillis; // This gives number of minutes since your target page visited.
if (time_since_last_visit < 30) {
return "true"; //Return true if target page is being visited in the same visit
}
else
{
return "false"
}
}