Create an audience based on previous URL visits
Hi!
I'm looking to target users that have visited jobs.dropbox.com/teams/engineering at any point in the last 30 days, not just those whose last page visit was this URL. This is the profile script I'm trying to use, but each time I hit 'save' I get an 'invalid user input' error.
// Define the URL to check
var targetURL = 'https://jobs.dropbox.com/teams/engineering';
// Function to check if the user has visited the specified URL
function hasVisitedURL(url) {
var visitedURLs = target.getExperienceCloudData('visitedURLs') || [];
return visitedURLs.includes(url);
}
// Check if the user has visited the specified URL and set a profile attribute
if (hasVisitedURL(targetURL)) {
profile.attributes.visitedSpecificURL = true;
} else {
profile.attributes.visitedSpecificURL = false;
}
TIA!