top of page
lummybhat

Two Methods to Track Site Search Terms In GA 4

The site search terms report in Google Analytics 4 is highly useful, as it helps identify users’ interests or potential needs, and indicates content analysis to improve engagement and satisfaction.

For example, if a search query is surging, we should consider adding related content to increase user experience effectively. Maximize utilizing these search terms in Google Analytics 4, optimizations can be made in the following aspects: page ranking optimization, discovering visitor needs, and title optimization.

Firstly, digital marketers are able to track and view what users are actually searching and looking for is the most important thing. In this chapter, I will give a complete instructions to show how to set up and track site search terms in GA 4.


How to Set and Track Site Search Term in GA 4


Method 1: Enhanced Measurement Event to Track Site Search Terms

When you search query at website, if the search result URL is like this structure, for example, https://www.b2bexplore.com?search=gtm,that is search=search query, which means you can open GA4 enhanced measurement events directly.


GA4- [management]-data stream


Open the related data stream detail page, then click the [set] button, you can see the page introduction.



Default search queries specifics are q, s, search, query, keyword. As long as the URL structure matches search=search term, the view_search_results event will be triggered.

Also additional query parameters can be customized up to 10 items, separated by commas.


Method 2: Customized Event to track site search terms

But if search URL structure, an example as below, looks like https://www.b2bexplore.com/search/ga2, the above method might doesn’t work. At this time, you should try another way- JavaScript code and customize it with GTM and GA4.


First: install Google Tag Manager(GTM)

Copy the code below and paste it on every page of your website. It will show you the steps.


Second: Create a new trigger, trigger type is page view, the page url contains /search/


Third: Search terms variable

Create a new variable, use customized javascript code to get search terms on URL.



Fourth: Create a new tag

Define the Event Name and event parameters name. The value is the variable named search terms just created.


ga4 event-track site search terms in GA 4

How to View Site Search Terms Queries Detail

Now, the default event name for site search on GA 4 is view_search_results, and the keywords people use are in search_term. Next, let’s see how to view site search queries in the report.


First, view how many times people search

GA 4-[Report]-[engagement]-[event], you can see [view_search_results].

But we can only view how many times people search. If we want to see the keywords detail, we should use GA 4 [Explore] or Looker studio for further information.


Second: View and export detail search terms

  1. GA 4/looker studio -Click explore-create a new blank;

  2. Dimensions-add search term , click confirm;

  3. Metric-add event;


    Track site search terms in GA 4


Common Mistakes

1.Regarding GA 4 event name and GTM configuration

If you couldn’t view the data, some like no data available, it might be no event created with the name of ‘view_search_term’ in your GA 4 account. So I recommend you to create an event in the GA 4 account to see the data.

  1. Create an event in GA 4 account

  2. Please follow the below steps to create an event in GA 4 account:

  3. In Admin, under Data display, click Events.

  4. Click Create event, then click Create.

  5. Under Custom event name, enter the name in this example as thank_you.

  6. In matching conditions, under Value, enter page_view.

  7. Click Add condition.

  8. Under Parameter, select page_location from the drop-down.

  9. Under Operator, choose “contains (ignore case)”.

  10. Under Value, enter the name of the page, which is https://www.example.com/thank-you.html.

  11. Click Create.


2. 99% of the search terms are blank

You probably don’t filter the event called view_search_results, because it is default as all events.

The report shows a lot of (unset) values because all events are analyzed. You need to create a filter on “Event Name” that exactly matches “view_search_results” to show data for only that event.

On the left side, at the bottom below, you can use “filters” to select the event name, the condition is exactly matches, and view_search_results, then click “apply”.


3.View_search_results are not triggered

If your site is separated between front-end and back-end or SPA, even the URL structure is matched, it won’t trigger the view_search_results event. The solution recommend is to use customize event tracking.

5 views0 comments

Comments


Commenting has been turned off.
bottom of page