Page 1 of 1

Google Analytics - Site Search - query parameter?

Posted: Fri Nov 24, 2017 7:39 am
by NorthEast
For a while now I've been using Google Analytics Site Search, after seeing a suggestion here on the forums (I couldn't find the original post!).

For all of my sites, I've set the Site Search Query parameter to record the Highlight parameter, but I've been wondering whether I should to record the q parameter instead.

The difference is that q will trigger after the initial search (when you're on the search results page), whereas Highlight will trigger when you visit a page after clicking the result.

Using either parameter appears to work - e.g. they'll both record search terms and other information - but they're recording different data.

You could also record both Highlight and q, although I'm not sure if that'll improve or just duplicate the information recorded.

Has anyone tried both of these parameters, and know which is the best approach?

Re: Google Analytics - Site Search - query parameter?

Posted: Sun Nov 26, 2017 4:31 pm
by Psider
What if the person runs a search, then doesn't click on a link (e.g. types another search term instead)? if you define the query as 'highlight' you don't capture the actual query.

Re: Google Analytics - Site Search - query parameter?

Posted: Tue Nov 28, 2017 1:22 am
by NorthEast
Psider wrote:What if the person runs a search, then doesn't click on a link (e.g. types another search term instead)? if you define the query as 'highlight' you don't capture the actual query.
That's what I presume will happen - it'll just record successful searches (where you click a result), but not searches where you didn't click on a result.

I was just wondering if anyone has tried setting up Site Search to record q instead of Highlight, and if that was better/worse.

Re: Google Analytics - Site Search - query parameter?

Posted: Tue Nov 28, 2017 8:00 pm
by Psider
My opinion would be that it would be better to see all the things people searched on, not just the ones where they found a topic they wanted to click on. So for example, you might see common mis-spellings, or you might find terms people are searching for that aren't in your documentation. And if you log q, then you should be able to see the terms people search for that don't return any results - although this requires some javascript and/or extra google admin "stuffs", I believe (can you tell I haven't tried this yet :) )

Re: Google Analytics - Site Search - query parameter?

Posted: Wed Nov 29, 2017 12:51 am
by NorthEast
Psider wrote:And if you log q, then you should be able to see the terms people search for that don't return any results - although this requires some javascript and/or extra google admin "stuffs", I believe (can you tell I haven't tried this yet :) )
No, GA's Site Search wouldn't tell you that there are no results - it'd just tell you if people didn't visit a page after searching.

I had to write my own script to record an event in GA if there are no results.

Re: Google Analytics - Site Search - query parameter?

Posted: Wed Nov 29, 2017 1:42 am
by Psider
The web pages I've found about "no results" are a little confusing; I wasn't sure if you could get the search terms without setting q as the search query in GA. :)

Re: Google Analytics - Site Search - query parameter?

Posted: Wed Nov 29, 2017 3:41 am
by NorthEast
Psider wrote:The web pages I've found about "no results" are a little confusing; I wasn't sure if you could get the search terms without setting q as the search query in GA. :)
You can use either Highlight or q as the GA Site Search parameter.
They both work and collect data, but collect different data - so my question was which is better.

Re: Google Analytics - Site Search - query parameter?

Posted: Sat Oct 05, 2019 9:14 am
by techwriter31
Hi Dave - which did you end up using? For one site, we're using Highlight and this works. But as you mention, it only works when a customer clicks on a search result. For another site, we have the query parameter set to ?q= and aren't getting any results. Should this simply be q instead?

Re: Google Analytics - Site Search - query parameter?

Posted: Sun Oct 06, 2019 5:44 pm
by Psider
I'm pretty sure just q. In my non-technical head, the ? is a separator between the web site address and Other Stuff(tm), so is neither part of the web site address, nor part of the Other Stuff.

I'm sure Dave will jump in to provide more accurate information. :)

Re: Google Analytics - Site Search - query parameter?

Posted: Mon Oct 07, 2019 1:20 am
by NorthEast
techwriter31 wrote:Hi Dave - which did you end up using? For one site, we're using Highlight and this works. But as you mention, it only works when a customer clicks on a search result. For another site, we have the query parameter set to ?q= and aren't getting any results. Should this simply be q instead?
Yes, just q

Same for Highlight, you don't enter ?Highlight=

I'm still using Highlight, which captures "successful" searches that lead to selecting a topic. Using q would track all search terms, whether or not a topic is selected.
I also track "unsuccessful" searches that have no results, by sending an event: viewtopic.php?f=13&t=27867#p127912