Analytics
5.1K members online now
5.1K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Site Search Not Working

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

I can't seem to figure out why my site search is not working. It reports that there have been no site searches, but I know there have been some searches because I performed a few for testing purposes. I'm looking in the Behavior > Site Search tab in Analytics. Here's an example of a search URL on my site: http://www.classhook.com/search?utf8=%E2%9C%93&search[query]=test&commit=Search. The query parameter for search is "search[query]." I've specified this parameter in my site search settings, like so:

Screenshot (723).png

 

Yet, for some reason it's not producing any search reports. I've rolled out my own search on my website, so it just runs a search on my database. I've searched online quite a bit but haven't found anything that's helped this issue. What could the problem be? Thank you in advance for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Class H
February 2016

Re: Site Search Not Working

Visitor ✭ ✭ ✭
# 12
Visitor ✭ ✭ ✭
Hi Grant,

I do send out the call, just not when the page first loads. I know this is true because all of my page views and searches are being tracked. The search results are just not appearing under Site Search.

I am using a plugin called Turbolinks, which replaces only the body of a page when the user navigates to a new page. This improves the performance of the website. The inclusion of this plugin is why I have commented out the code snippet above, as the entire page is not reloaded.

But actually, I think I found the problem, so thank you for pointing out the code as the issue! I had this code loaded in a separate JavaScript file:

ga('send', 'pageview', window.location.pathname);

I've changed it to this:

ga('send', 'pageview', window.location.pathname + window.location.search);

It now includes the search parameters! I'll wait on it a day or two and let you know how it goes. Thank you for the help!!

View solution in original post

Re: Site Search Not Working

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Hi,

search[query]

Square brackets might be an issue.
Can you try to change the url format for search parameter?

Best Regards,
A.T.

'Star' or 'Accept as Solution' if it helped.

Re: Site Search Not Working

Participant ✭ ✭ ☆
# 3
Participant ✭ ✭ ☆
When did you configure Site Search option and how long did you wait before you've checked reports?

Re: Site Search Not Working

[ Edited ]
Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Thank you for your replies!

 

I configured my Site Search option a couple of weeks ago and have been checking reports every day since then. I think the square brackets may be the issue because they are sometimes being encoded, so it's possible Google Analytics is not reading the value correctly. I've just changed the search parameter to "q," so I'll see how it works over the course of the next couple of days and let you know.

Thank you for the help!

Re: Site Search Not Working

Participant ✭ ✭ ☆
# 5
Participant ✭ ✭ ☆
Hi,

I have checked your settings with search[query] and it's working fine. So it wasn't an issue.
You probably didn't wait enough time.

Re: Site Search Not Working

[ Edited ]
Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

How long should I wait to see the Site Search feature working? I switched over to using "q" as a search parameter and have updated my Site Search settings appropriately. So far it's been almost a week with no results.

Re: Site Search Not Working

Follower ✭ ✭ ✭
# 7
Follower ✭ ✭ ✭
its usually maximum within a day if you have large site and within a few hours if its a small site
are you checking teh right proprty - it should be: UA-59728292-1

Re: Site Search Not Working

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
Thank you for your reply! Yes, I am checking the correct property, and I still do not see any results. Is there anything additional that I need to add to my JavaScript tracking code? Everything else is working fine.

Does the website need to have a particular search URL? For the search query, "test," my relative URL is as follows: /search?q=test

Re: Site Search Not Working

Follower ✭ ✭ ✭
# 9
Follower ✭ ✭ ✭
The page appears to be tracking ok and sending calls to Google.
- Have you got any filters in the account that might be hiding your data?
- in Behaviour -> all Pages do a search for your search page and see what comes up. Does it appear?

I reckon its down to a filter thats the root of your headache.

Re: Site Search Not Working

[ Edited ]
Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭
  • I only have one filter, which is for removing Ghost Referrer Spam
  • My search page appears, but it doesn't display any parameters. It shows "/search." Should it be displaying the parameters? If I view by Page Title instead of Page on this screen, I see all the search results but only because the search results are added to my page title. This is not as effective for reporting as the Site Search page.