Expand my Community achievements bar.

Take 10 minutes to complete an Adobe Target review on Gartner Peer Insights, and as a thank you for your time, you’ll have the option to receive a $25 gift card!

Profile Scripts for mobile app

Avatar

Level 1

I have to select a landing page if an user has been there. Then a variable might be returned with some string. I have used page.url.indexOf and mbox.name.indexOf but nothing happens. Can you help me?
This's the code I was trying:

var r;

if (page.url.indexOf("additionalCardHiring") > -1 || page.url.indexOf("additionalCardProducts") > -1 || page.url.indexOf("additional-card-products") > -1 || page.url.indexOf("funds-hiring") > -1){
r = "atdc";
}
else if (page.url.indexOf("fundsHiring") > -1 || page.name.indexOf("fundsHiring") > -1 || page.url.indexOf("funds-hiring") > -1 || mbox.name.indexOf("fundsHiring") > -1 || page.url.indexOf("additional-card-products") > -1 || page.url.indexOf("additional-card-hiring") > -1) {
r ="fci";
}
else {
r = "dft";
}
return r;
This code always returns "dft". Thoose strings in indexOf() methods are from localStorage url, mbox name (supossed), adobeTarget.pageName() and location.href url.

Thank you!


1 Reply

Avatar

Employee Advisor

Do you have an example of the payload that is sent to Target?