Using the new site search feature in Google Analytics

Note: I hope you will find this information useful, but it is not intended to be a step by step guide. The way you might implement this on your store could be different and you will need RTML and CSS knowledge. Please don’t attempt unless you are comfortable with this. Also, the steps in here are for those of you using the standard site search in Yahoo! Store. If you use another site search solution such as Celebros, SLI or Nextopia, jump to 3) at the end of these instructions.

Why is site search analytics important?


I talked about the importance of site search before this feature became available in Google Analytics. The new site search feature in Google Analytics can give you insightful information, but you have to (unfortunately) implement a little hack in your Yahoo! Store in order to get this to work consistently. The tracking code looks for the search terms in the URL, but this is not always available when you do a site search. This hack describes the approach that I have taken to "force" the Yahoo! Store site search to display the search parameters in the URL all the time. However, every store is different so the specific steps you might take to get this to work could very well be a little different. If you are not comfortable adapting this approach for your Yahoo! Store, please contact your designer or me.

Of course the benefits of implementing this hack far outweigh the small effort to get site search analytics data.


1) In the Store Editor, edit the nsearch page (which is the site search page).

Add a new site search form code in a visible field such as caption. Make sure to use the right identifiers specific to your store (yhst-123456789 or and design as necessary. This will essentially add another site search form to the page. What we want to do is get visitors to use this form instead of the one generated automatically by the template. My approach involves hiding the template form by using CSS. Take a look at the Head-tags field. I have overridden the Head Tags field and added some simple CSS to hide input fields.


2) I want to make sure however that I only hide this specific form and not hide all input fields. In the template that generates the form field I made a simple modification:


Using a TEXT operator, I just wrapped a simple div element with a unique id around the SEARCH-FORM operator. This now allows us to use a CSS rule to just target this div and hide the input fields inside of it.

3) You also have to set up Google Analytics to start tracking site searches. See here the official introduction and help file.

In the Query Parameter field enter: query,nquery


Why the nquery? We can track zero-results searches, i.e those that returned no results. A true treasure trove of information. query and nquery will be lumped together in the Site Search reports, but you can get more detailed information in the Contents reports; just search for nquery in Google Analytics: Find URL.


And for those of you using another site search tool, such as Celebros, just do a site search on your site and look at the URL and find the parameter that has the site search term. It’s likely to be also called query. Of course make sure that the site search results pages are tagged with our tracking code too.