3

My search returns results at the following URLs:

(for a single search term)

search/keyword/ 

(for a filtered search using the same term)

search/?sections=articles&keywords=keyword  

In GA, I have:

  • Query parameter = search/
  • Category parameter = sections, keywords

However in the reports the site search category is coming back as '(not set)' even after a fortnight of use.

3 Answers 3

1

GA site search requires a query parameter in your URLs to base site search requests off of, for example search?keyword=mySearchTerm. In this example you would enter 'keyword' into the site search configuration.

If your search results page doesn't have a query parameter, then you may need modify your page URL to include it. More information can be found here.

3
  • Seemingly GA is happy with 'search/' as a query parameter because it's giving me realistic stats on visits with/without search. It just can't seem to figure out the category parameters I'm supplying. Commented May 13, 2015 at 7:53
  • Are you able to see your search terms show in the Site Search reports?
    – nyuen
    Commented May 13, 2015 at 13:49
  • Yes - to get around the permalink not being a true query parameter, there's a filter on the view. It looks for Request URI '/search/(.*)/' and maps the (.*) to a search term. Perhaps the only way is to remove this and adopt MagicDude4Eva's JS-based solution. Commented May 14, 2015 at 9:04
1

You can always use GA to provide a virtual path when your search is executed:

ga('send', 'pageview', '/search?query=mysearchterms&category=mycategory');

Just make sure that the search terms/category are both URL encoded. You can then use those params in the setup of the site-search.

1

To build on the point that @MagicDude4Eva made, you can follow this guide (particularly section 1) in order to get the site search metrics working fine based on your current URL structure. It requires Google Tag Manager to work however you could use the same JavaScript to do this manually if you have code access to the site.

The reason you are getting sessions with / without search data is due to the fact that GA recognizes based on your setup that something was searched, however without a URL parameter it cannot see what was searched. Therefore it'll count a search session but no categorization.

Your Answer

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

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