How to Setup Site Search in Google Analytics

In this post, I’m going to show you how you can set up Site Search in Google Analytics to track the searches users perform directly on your website.

Site Search is a useful feature in Google Analytics as it helps us understand what keywords people are entering into your website search box.

In this video, I will be sharing how you can configuring Site Search on your website using the query parameter in the website URL that appears after a search.

There’s actually a technique where you don’t have to install too much because you have already Google Analytics installed by just configuring Google Analytics. And it will start tracking your site search which is really helpful if you want to try to find out more about what your users actually searching for.

Chances are they are using your site search and this is valuable information to and fills with the intent of the user on the website. So you definitely should not miss out on this data if you don’t have it installed, yet. So without further ado, let’s dive into Google Analytics and configure our site search.

All right, to get started, we are here on the official merchandise store of Google. And we actually have access to the Google Analytics of this website. There’s a link in the description down below how you can get access to it as well. And here we go. This is the Google Analytics merchandise store demo account for Google Analytics.

And here we see that data. When we go down here to the behavior reports. And under site search, we see that there’s all kinds of tracking data about what has the user search for on the website. So when you type in anything, right here, an internal Site Search gets triggered, and the search results are displayed right here.

So how can you configure this for your own website so you know what the user has actually searched for? Google Analytics has built-in functionality to pick up such searches and it’s all based on the URL of your store right here. In the back of the URL, we have a query string. And you can see this by looking at the URL and seeing the question mark, and everything behind the question mark is called a query string. And here we have certain information that is encoded in this query string.

One distinct information right here is the keyword equals test. Now, test is what I put into the search bar earlier. And therefore this is the actual search term that we would like to record. Let’s try another one.

And we get to the results page. Some results are not quite relevant. But who’s complaining This is after all, the merchandise store of the largest search engine in the world. But here we see again, our keyword t shirt that we just put in. And this is something we would like to track in Google Analytics. Now every time you enter a new page, information gets sent over to Google Analytics by default. With the tracking code that you have installed this information gets sent and a page view is recorded within Google Analytics.

Since the URL is also transferred to Google Analytics, really what we just need to tell Google Analytics is that we have a certain key here that always afterwards after the equal sign has our keyword. So how can we tell this to Google Analytics to pull this up? It’s actually pretty easy. It’s under the admin section here. In your reports, you can go to View Settings. And under your view, down below here, we have a section called Site Search. This needs to be turned on. And then we just need to put in our key that has our search term in there.

So Google Analytics knows where to look for this. Then we can choose to strip this actually out of the URL. So when we look at URLs inside of Google Analytics, we don’t see keyword equals whatever the search term was. This is particularly important when you don’t want to have your reports broken up by search terms. Optionally, we could also do such categories. But that’s something that would really need to be in your query string as well, in order to make this over.

So now that you know how to do this, let’s try it out. On our demo shop right here, we have also a search field. And I’m going to put in a search term. And we’re getting to the result page with our keyword right here.

Now when we look in the URL, we again see a query string. And our search term is encoded in this query string. And this time, it’s preceded by an equal sign with an S. So S is actually the key that Google Analytics should pull up. So within our Google Analytics account, let me switch over.

We again can go to our admin section right here, go into the view settings. And then when we scroll down, we have our site search setting, toggle this to on. And then we need to put in our query parameter. Now, this is exactly what needs to be in front of the equal sign right here. So Google Analytics will be able to identify it. Again, here is S, before it was keyword and merchandise store. So let’s go ahead and put this S into Google Analytics.

And let’s strip this out for now. And we leave the site search categories untouch. We don’t have a category parameter. Anyways, and then we simply save it, we get the success message. And now we should be able to view our data inside our site search and search terms. Now, unfortunately, when we search something, and it gets sent over to Google Analytics.

It goes through a processing engine, and therefore, it will take a while till we get results into our report to see what the user has searched for. So we don’t see any data right now. But when we reload this page, hopefully in a few hours, we’ll have data in our report.

So this is how you can set up Site Search tracking with the help of Google Analytics and your query parameters. By the way, if you don’t have query parameters in your search box, then you would need to track your site search separately. And you can, for example, do this with the help of Google Tag Manager. But that’s a question for another video. All right. So there you have it.


This is how you can configure your Google Analytics site search. Isn’t that a neat feature of Google Analytics? Now, you might be thinking, I don’t have something in the URL itself how do I set this up? There are other techniques and Google Tag Manager out there how you could do this, please let me know in the comments down below that I should do a post about it.

And if you’re looking for more support on Google Analytics, Google Tag Manager and all things data then You might want to check out our premium membership measuremasters.

This is where we put all our premium content, give you support, and have an awesome community of other marketers as well. So definitely check that out.

Julian Juenemann
About the author: Julian Juenemann

Julian started and grew venture-backed startups with his unique 'data first' approach to Online Marketing. He then founded to help marketers, like him, the data-driven way of digital marketing.

Inline Feedbacks
View all comments