Google Analytics 4 allows you to track the specific queries searched on your site with an enhanced measurement event. This can provide useful information for all types of businesses. So whether you have an eCommerce store, a B2B site, or a blog, check out this guide to setting up GA4 site search.
To track site searches with GA4, the only ingredient we need is a successfully installed Google Analytics 4 property. If you’re here, hopefully that’s already done. But if not, this linked 5 minute installation guide will get you straight.
By the way, if you want the video overview of GA4 site search setup instead of this written version, just play this video and skip ahead to the 3:50 mark so you don’t have to watch the part detailing the process for UA.
Still here? Great! Read on below for a review of the major steps to get your GA4 site search working properly.
1.) Ensure that site search enhanced measurement is turned on
Hit the gear icon in the bottom left corner of the screen to access the admin section.
- Then, click on “Data Streams” which is the 4th option from the top of the Property-level admin section in the middle of the screen.
- Click on your specific data stream for your GA4 property.
Now, you should be able to see the enhanced measurement events you are tracking. Click in to the gear icon as shown below.
By default, all enhanced measurement events will be turned on. If you’ve since gone and changed that, make sure that the site search event has been turned back on. [Please note: there are sometimes that we may want to toggle some of these events off. Scroll depth is a great example of an enhanced measurement event that we can track much more effectively with the help of Google Tag Manager.]
You can see the site search enhanced measurement event below.
2.) Review the site search query parameter for your specific site
The enhanced measurement event will work for *most* sites in the default state. Other sites will need to add a search term query parameter to make sure their site search data is being captured in the GA4 data stream.
The best way to find out is to perform a search on your site. Here’s an example of what it looks like when I search for “ga4 bounce rate” on the Root and Branch site. The specific search I looked for is in the red box. Do you see the search query parameters appended to the end of the URL in the blue box at the top of the screen? Check out the first character that follows the question mark after the trailing slash after the hostname. There is an “s” there, which I now know is the default search term query parameter for the site.
As it turns out, this means I don’t need to do any additional configuration with the enhanced measurement event. But unless you have the exact same one, you won’t know that until you go through step 3 below.
3.) Review the “advanced settings” of the site search event and add an additional query parameter if needed
Look again at the list of enhanced measurement events that we checked out at the end of step 1. You should see “Show advanced settings” underneath the site search event. Click into it and you’ll see this below.
As long as the search query parameter for your site is included in the list of “Search Term Query Parameter[s]”, you’re in good shape. Congrats! If not, don’t worry. All you need to do is add your specific query parameter to the list. As you can read below, you can specify up to 10.
You are now tracking the data properly. But without step 4 you won’t be able to see it. Weird, right?
4.) Register the search_term event parameter as a custom dimension
Registering event parameters is custom dimensions is one of the oddest parts about GA4 for those of us who were used to UA. If that previous sentence made no sense, you might want to check out this custom dimension explainer video so you don’t waste months being confused like I did. Suffice it to say, if you don’t do this you’ll be able to see how often a site search took place, but you won’t be able to see what search terms were actually searched. So it would be pretty useless and it’s worth reviewing that previously linked video if this surprises you.
But if you’re comfortable with custom dimensions, these next steps won’t sound so odd. So hit the “Configure” button on the left-hand navigation of your GA4 property.
- Then, click on “Custom definitions”, which you should see right below “Audiences.”
- Hit the blue button on the right to “Create custom dimensions.”
Now, we’re going to create this custom dimension. The “Dimension name” is how this dimension will show up in your reports. I’ve called it “Site Search Term” but you can go nuts if you have a different preference. Make sure the “Scope” is set to “Event”. The description field isn’t necessary, but if you want a reminder for what you’re tracking you can add it here. The event parameter is less flexible and less optional. Set it to search_term as you can see below.
You’re now good to go! Congrats! The specific search terms will now flow into your reports. You can see this data in your Engagement standard reports. Or you can use the Explore feature to create an exploration (aka, a custom report within GA4). But the best approach might be create a report in Data Studio that will update automatically for you.
5.) Create a Site Search report in Google Data Studio
This step is optional, especially if you have another reporting preference. Otherwise, follow the steps outlined in this video and build the report. There’s a link to a template that you can populate with your own data if you don’t want to start from scratch.
That link is in the description of the video on YouTube and I’ll paste it immediately below as well.
Here is that Data Studio report link. Boom!
I hope this helps as you think about your future plans for web analytics. Don’t forget that Universal Analytics data will no longer be processed in that platform beginning July 1, 2023. In other words, it’s time we get more comfortable with GA4.
If you’re still someone learning about GA4 (as I am), I’d recommend checking out this GA4 vs. UA comparison or this list of updated GA4 questions. You can also subscribe to the Root and Branch YouTube channel for an updated video every week or so. I’ll see you there!
About Root & Branch
Root & Branch is a certified Google Partner agency and focuses on paid search (PPC), SEO, Local SEO, and Google Analytics. Hit the button below to check out YouTube for more digital marketing tips and training resources.