Parse/trim Querystring parameter

Gold Contributor
Gold Contributor

I  am trying to capture a portion of the querystring (data type) and populate a new Adobe eVar based on this criteria.

 

If the querystring contains a â q=â and contains a â sort=â then copy the â sort={value}â thru the end of URL into a new variable.

 

Example: http://www.oakley.com/en/mens/new-arrivals/new-sunglasses/category/m0101?q=%3AoakleyusRelevanceSort&... Result: querystring_first= â %3AoakleyusRelevanceSort&sort=oakleyusName-descSort#â querystring_last=â oakleyusName-descSort#â jQuery Extension- Does this work? b['new_querystring_first'].split(" b[new_querystring_last| â sort=")[0]

1 REPLY 1

Parse/trim Querystring parameter

Employee Emeritus
Andre Are you trying to find out what is in the querystring sort? In the console you can see what is in sort by using the following command: utag.data["qp.sort"] If you are wanting to set an eVar, you can do this with a Set Data Value extension scoped to Adobe. You just need to add a Data Layer in TiQ of Type querystring and name sort. Then you will be able to pick sort from the drop down list in the Set Data Value Extension. If you need to add this string to something else, you can use the JS Code within the Set Data Value and do something like: b["dom.url"] + b["qp.sort"]
Public