I'm trying to track internal search terms entered in the search box by visitors on a web page. But the given search box is divided into 3 sub boxes with each search box having its own URL parameter. URL for a sample search appears as (www.example.com/search?k=analyst&c=alliedhealthsocialservices&l=Columbus,%20Ohio&t=regularparttime). How to track all the search terms entered in 3 search boxes? Do i need to create separate Data Elements for each individual search box? Can anyone tell me how do i processed further?
What is your end goal here? Are you trying to capture each of the search terms in their own variable? If so, the above solution should work. If not, can you give us an idea of what your ideal solution would look like? For example:
I would suggest capturing all the 3 parameter values in respective variables in the custom code of your DTM rule using the getQueryParam utility assuming you are using Appmeasurement library. Your custom code should look something like below:
Hey Josh, Here is the clarification you have asked for. When a user enters a search term in text box and clicks on search button url will be like example.com?k=xxxxx and then after two seconds it changes to example.com?query=xxxxx and the user is directed to search page.
Okay well if those query parameters really do represent arbitrary text a visitor enters into fields, then personally I would push them to separate Adobe Analytics variables instead of concatenate them, because there's no guarantee on how many characters they will be or what characters will be entered.
I'm not sure I understand what you mean... is your site just using different query parameters for search terms, depending on the page or search widget used? So e.g. maybe you do a search and it pops k=[search term] but on search results page you do another search and it instead pops query=[new search term] ? If so, then it sounds to me like you shouldn't concat them, but instead just look for either one and push to the variable.
Or is it that a visitor can go to your site and search for something that results in both of those parameters showing up in the URL at the same time, with different values?
I think I need clarification about how your site actually works vs. these two parameters.
As others have stated, can you please clarify / provide more details about which query parameters represent what?
Based on what you've said vs. what I see in the URL, it seems like k=, c=, and l= are pre-defined dropdown/selection/filter values, and t= is the actual search term? If so, I would consider keeping the t= (actual search term) as a separate eVar, and depending on char lengths for the other ones, I would push them all to a single eVar concatonated, e.g. "[k=]|[c=]|[l=]" and then create classifications and classification rules to break them out into classified reports.