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.
Hello @gokula :
var text = "How are you doing today?";
varcount = text.split("are").length -1;
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.
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.