Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

Tracking # Search Queries with no page refresh

Avatar

Level 6

Hi All,

I know Adobe Analytics, out of the box, tracks searches that contain a “?” within the URL.  What happens if you have a “#” instead? My company is starting to use the "#" in a new search appliance they developed on one of our domains however I am using the url parameter in DTM which looks at the "?". Is there a way to add "#" as another url parameter for DTM to look at for the same query name.

things to know:

  1. We still need to utilize the "?" as well as add the "#" as a query parameter. I'm hoping there is a way to just modify the appmeasurement code to accept "#" as a query parameter that way when I create a data element in DTM  and look for "q" then it will grab the same value regardless of the "?" or "#".
  2. The names (q,s, filter, type) for each query remain the same for each query parameter.
  3. Also, the new search appliance does not do a page refresh when selecting new filters. How could I capture the new data in the url without a page refresh to trigger the new values added to the url?

thank you in advance for any and all help,

Scott

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Steve,

  1. This moves out of the native DTM realm and into the JS realm. You can use window.location.hash to grab the hash text and window.location.search to grab the query string. You can then filter the data and pass it in to a data element.
  2. You'll either want your search to trigger a direct call rule, or you'll want to create an event-based rule to fire when the page searches.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi Steve,

  1. This moves out of the native DTM realm and into the JS realm. You can use window.location.hash to grab the hash text and window.location.search to grab the query string. You can then filter the data and pass it in to a data element.
  2. You'll either want your search to trigger a direct call rule, or you'll want to create an event-based rule to fire when the page searches.

Avatar

Level 6

I really wanted to try and stay away from the JS realm and had wanted to really see if I could modify the getQueryParam or some other plugin in the s_code to simplify the process.

thanks for your help