1

I use Google Analytics to track the searches users do on my website. I have no query parameter for searches (nothing like q=mykeyword). Therefore I use Google Tag Manager to send a "fake" value for the field page to Google Analytics with the following snippet:

function() {
  var regex = /^(\/[a-z]{0,2}\/live\/search)\/(.*)/;
  if(regex.test({{Page Path}})) {
    var res = regex.exec({{Page Path}});
    return res[1]+"?gaSearchLive=" + res[2];
  }
  return;
}

A typical URI used for searches is /de/live/search/mykeyword?searchID=1234 or /en/archive/search/mykeyword2?searchID=4567.

My website differentiates between live and archive searches. Is there a way to separate those two kinds of search in a way that I can analyze them separately in Google Analytics?

How can I prevent query parameters from polluting my analysis? In section Behavior => Site Search => Pages I see the following:

pages with query parameters

Is there a way to remove parameters like "searchID" / "page" etc. from the url? How do I need to modify my Google Tag Manager tag? Is it possible to overwrite the url sent to Google Analytics as I do already for the page field?

1 Answer 1

1

I would use separate views for each. One that includes pages that start /de/live/search and one for /de/archive/search.

Then you could exclude the query parameters from your main reporting view in the view settings.

1
  • Thank you for your answer, I excluded the parameters via view settings. Regarding separate views for live / archive searches: I find it very confusing, because I need to switch the views often. Is there no solution, creating different reports one for live / archive and add them to the Site Search menu? Or maybe via custom dashboard? I tried already but dashboards cannot display tables with more than one dimension... So I need to view every custom report itself instead of having a overview of all relevant searches... Apr 10, 2018 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.