Creating a Profile Script to Return True After visiting specific pages using the page name parameter | Community
Skip to main content
February 4, 2025
Solved

Creating a Profile Script to Return True After visiting specific pages using the page name parameter

  • February 4, 2025
  • 1 reply
  • 1149 views

Hi there Adobe Target Experts,

 

I'm looking to create a Profile Script that will return a value of 'true' if a visitor has visited any pages from a group of specific page names.

 

Has anyone done this before at all?

 

Cheers.

Best answer by Vaibhav_Mathur

Hi @SamB2024 , 

I am assuming you're using the at.js configuration approach of Adobe Target. I think the code given below will work for you.

 

var flag=user.get('YourProfileScriptName')||'False'; var Pages = ['HomePage', 'CategoryPage', 'ProductPage']; if (Pages.includes(mbox.param('page_name'))) { flag = 'True'; } return flag;

 

 
Please let me know in case you're using a webSdk approach, I'll share an updated code then.

Hope it helps. 

Best Regards, 
Vaibhav Mathur

Views

 

1 reply

Vaibhav_Mathur
Community Advisor
Vaibhav_MathurCommunity AdvisorAccepted solution
Community Advisor
February 4, 2025

Hi @SamB2024 , 

I am assuming you're using the at.js configuration approach of Adobe Target. I think the code given below will work for you.

 

var flag=user.get('YourProfileScriptName')||'False'; var Pages = ['HomePage', 'CategoryPage', 'ProductPage']; if (Pages.includes(mbox.param('page_name'))) { flag = 'True'; } return flag;

 

 
Please let me know in case you're using a webSdk approach, I'll share an updated code then.

Hope it helps. 

Best Regards, 
Vaibhav Mathur

Views

 
abhinavpuri
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 4, 2025

I think we need to add

user.set('YourProfileScriptName','True') as well in Profile snippet above to keep profile script value intact.

Level 2
March 16, 2025

but how to pass first this parameters to global mbox using at.js?

var flag=user.get('YourProfileScriptName')||'False';
var Pages = ['HomePage', 'CategoryPage', 'ProductPage'];
if (Pages.includes(mbox.param('page_name'))) {
flag = 'True';
}
return flag;

 

I assume that these parameters needs to be passed first to at.js in order to filter them in the future?


Hi @michael_soprano ,

 

That is correct understanding, In above example profile script will look for mbox.page_name parameter in order to set flag as expected.

 

The mbox.page_name paramter will need to be passed from client side (using at.js)