How to Set up Site Search in Google Analytics

Do you want to find out what people are searching for on your own website, not how they got to your website from Google Analytics? There’s a nifty tool inside of Google Analytics that shows you what people search for on your site called Site Search. But it’s not enabled automatically and you need to take just a few minutes to set it up. Follow this tutorial for the full details.

What is Google Site Search and How Does It Work?

Google Site Search is a tool that allows you to see what visitors search for in your website’s tool bar. You can use it to find out if your website is difficult to navigate or if visitors aren’t ending up at the right places when they enter your website. It’s a great tool to tell you if your SEO is effective at guiding people to the right places or if there are pins with lost URLs on Pinterest.

Site Search works by reading the URLs of search results on your website.

Understanding Website Search URLs for Site Search

For instance, if you search for the letter h on this website using the search bar at the right, you’ll get to this URL:

Obviously, the beginning before the question mark is the website URL. But what about the rest of it? What does it mean?

A “?” or question mark in a URL means that the user is asking for data to be relayed to the server to produce a result, called a query. There are all kinds of queries that a website server can be asked to do but in this case, it’s a search query.

How does the server know it’s a search query? By the parameter of the search, or a definition of the operation the server needs to perform. In this case, the parameter is “s”. If you look at other URLs, you might find that this parameter is a different letter or a phrase like “query” or “search.” It doesn’t really matter what the parameter is, just as long as the server knows what to do from an assigned definition in the website’s programming.

The equal sign of “=” tells the server that the search query is whatever falls after that. In this case, it’s the letter “h” because that’s what we searched for on the website’s search bar!

(If you want to learn more about the PHP behind query strings like this one, this post on StackOverflow is a good resource. In this case, this is a GET, not a POST.)

What if my website search URL doesn’t look like that?

There are a lot of different ways to write parameters and other things can be added on to server requests, especially if your website is a bit more advanced. You can add things like category-based searches that only pull from certain categories (like only the t-shirt section of a online clothing store) or to search only in specific languages.

Take, for example, this URL from an Etsy search where I looked for “blog” in the Handmade Geekery section:

https://www.etsy.com/search/handmade/geekery?q=blog

Applying what we know, “q” is the search parameter and “blog” is the search query because they come after the ?.

But, we can also see that there’s extra to this string to give us more information. Geekery comes just before the question mark and handmade is in it’s own bit of the URL with slashes. What does that mean?

Things between a slash, like handmade or search, are typically folders inside of the server. Inside of the folder handmade, you’ll find all the information for all of the listings that fall into this category. Geekery is also a folder inside of handmade, further categorizing the listings. (Remember, each listing is an individual webpage!)

How to Enable Google Analytics Site Search

Learn how to use Google Site Search and find out what people are searching for on your website with @bearandbeagle!

The best way is to watch the above video so you can follow along step by step!

  1. Sign into Google Analytics
  2. Go to your Admin
  3. Select the right Account, Property, and View where you want to add Site Search. You must do this for each View you want Site Search enabled.
  4. Go to View Settings
  5. Scroll down to Site Search and toggle it Site search tracking On at the bottom of the page.
  6. Add in your search parameter from your URL.
  7. Optional: Add in categories for search sections, as described above.
  8. Search for something. Go back to your Analytics in a few hours to check to see if Site Search works correctly in your reports.

I hope this helps you understand how URLs work and why Google Analytics Site Search works well to help you figure out how visitors are interacting with your website! Be sure to send in any questions you have for my next video.