Set up Site Search in Google Analytics
1. Configure Google Analytics to set up a site search based on a query parameter: the string that comes between the ? and = in the URL.
If your site doesn’t use ? in the URL for query parameters – some use # or other characters – you can do a URL rewrite with GTM to override anything that isn’t ?. Check this by searching on your site search and looking at the URL.
2. Locate your query parameter by looking at your website URL in the browser address bar. The query parameter is the word or letter just before the equal sign and your search term. This will vary depending on your platform.
For WordPress, this is usually s. For Squarespace or Wix, it’s q. For PhotoShelter, it is I_DSC.
3. Navigate to Admin > View Settings and enable Site search tracking. In the Query parameter field, enter the parameter you found earlier.
If you used more than one platform to create your site, enter additional parameters separated by a comma. If you have multiple views in GA, add this to all views that you want to analyze. Tick Strip Query Parameters out of URL to exclude the extraneous unique session IDs that appear in the URLs, for a cleaner report. Click Save.
4. View your traffic’s search terms in Google Analytics by navigating to Reports > Behavior > Site Search > Search Terms.
Search Term: The search term users entered in the search box on your website. Total Unique Searches: The percentage of total unique searches for each keyword. Results Page Views/Search:The average number of times the search results page was viewed after the search was performed. % Search Exits: The percentage of exits from the site that occurred following a search instead of clicking on a result. This can indicate the searcher was not satisfied with the search results. % Search Refinements: The percentage of searches where a user searched again immediately after a previous search. If this number is high, it may indicate that the search results are not accurate. Time After Search: The average amount of time visitors spent on the site after receiving search results. Avg. Search Depth: The number of pages viewed by visitors after receiving the search results.
5. Analyze the data you get from the search terms and look for content gaps and user behavior trends.
Ask questions like: Do certain queries get searched more than others and lead to exits? This is a sign that you have content gaps. On which pages are people using search the most? This might show that your navigation is misleading. How many searches do people do on average before exiting? What are the trends and patterns of user’s actions after they use search?
6. Consider using other solutions if your site search functionality is non-standard, or you need extra features.
If your URLs are messy with different parameter types, you will need to use GTM to rewrite them. Google Data Studio and some CASE functions will provide the same visuals as GA, but greater flexibility in your reporting.