I am trying to code a profile script that looks for some query parameters. At some point after I have split the query parameters into an array, how should i iterate over the array to find the query parameter I need. I have tried using for, forEach, while loops...all show some syntax error although the function works perfectly fine when ran on the browser console.
Views
Replies
Total Likes
Hi @sonalipai
As you said it's working fine in bowser console however not in profile script, Is it possible you to put your code here in dummy form so we can troubleshoot
Views
Replies
Total Likes
Hello @Gokul_Agiwal :
Found the solution, apparently iterators do not work in profile scripts that is because adobe targets does not like javascripts with more than 2000 js instructions in the script. The easiest way was to use a split() function.
Example like
var text = "How are you doing today?";
varcount = text.split("are").length -1;
Views
Replies
Total Likes
Glad that it's working now, Thanks you.
Views
Replies
Total Likes
Looks like you found a solution. There is a pretty decent built in method also just to share:
var param = page.param('PARAMETERNAME');
If you know the name of the page query parameter you can reference it directly in a profile script like above.
The little "available tokens" widget on the right side of the edit script pane shows some of these.
Hope that is helpful.
Views
Replies
Total Likes
That was my initial solution. But unfortunately, there is no good documentation around page.param.
How should page.param be used if there are multiple same name params in the query string. I was assuming that page.param would return an array, but i think it returns a string.
Thanks
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies