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!
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
@KatherineKe 1. There are two ways to use Analytics data in Target:
a) Create a segment in Adobe Analytics and publish it to Target
Drawback: There would be a delay of around 8 hours to qualify for this segment.
b) You can create Audiences in the "Audience library" using the same data as Adobe Analytics. These audiences work in real-time.
2. Check once if you are able to save simple profile script or not.
like, return geo.city and try to save this.
If this is working then it means some issue with your profile script code else it's a UI issue. Contact to Adobe Support team.
@KatherineKe You can use Analytics audience to achieve such kind of use cases.
Document link: https://experienceleague.adobe.com/docs/core-services/interface/services/audiences/audience-library....
If you want to achieve this use case via a Profile script then you need to stores the value of user visited page in last 30 days. I am just giving it a try, not sure if this will work exactly or not but you may tweak it.
// Define the target URL and the timeframe (30 days in milliseconds)
var targetURL = "https://jobs.dropbox.com/teams/engineering";
var timeframe = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds
// Get the current timestamp
var currentTime = new Date().getTime();
// Check if the user has visited the target URL in the last 30 days
var lastVisitTimestamp = localStorage.getItem("lastVisitTimestamp");
if (lastVisitTimestamp) {
lastVisitTimestamp = parseInt(lastVisitTimestamp, 10);
}
if (lastVisitTimestamp && (currentTime - lastVisitTimestamp) <= timeframe) {
// User has visited the target URL in the last 30 days
// You can now set a profile parameter or trigger an action for this user
// Example: Set a profile parameter
mbox("profile.parameters.visitedJobsPage", "true");
} else {
// User has not visited the target URL in the last 30 days
// You can set a different profile parameter or take other actions as needed
// Example: Set a different profile parameter
mbox("profile.parameters.visitedJobsPage", "false");
}
// Update the last visit timestamp to the current time
localStorage.setItem("lastVisitTimestamp", currentTime);
Hi @dsingh16 - thank you so much for the response! Two questions:
1. When you say Analytics audience, do you mean create this in Adobe Analytics?
2. Anytime I try to save a profile script, such as the one you provided above or any ones I've written, I get an 'invalid user input' error. Is there a step I am missing?
@KatherineKe 1. There are two ways to use Analytics data in Target:
a) Create a segment in Adobe Analytics and publish it to Target
Drawback: There would be a delay of around 8 hours to qualify for this segment.
b) You can create Audiences in the "Audience library" using the same data as Adobe Analytics. These audiences work in real-time.
2. Check once if you are able to save simple profile script or not.
like, return geo.city and try to save this.
If this is working then it means some issue with your profile script code else it's a UI issue. Contact to Adobe Support team.
@dsingh16! I added this segment in Adobe Analytics to create it as an audience in Adobe Target...
I activated it in Adobe Target, yet my specific experience activity isn't showing up after I visit jobs.dropbox.com/teams/engineering...