GET FREE VERSION GET THE PRO VERSION

Google Analytics

How to send and view plugin search stats inside Google Analytics.

In this article

Overview

Key features of integration:
  • Track search events. Get full analytics about your website search events.
  • GA dashboards support. Display data about all search events inside your GA dashboard. Create any report view that you want.

Plugin has the option to track via Google Analytics all searches that were made on your site.

By default this option is disabled but if you already have Google Analytics installed on your site then you can enable it from the plugin settings page.

Google Analytics integration

Google Analytics integration

After you enable it the next step is to properly configured your Google Analytics instance to properly display users search queries.

Search queries inside Google Analytics dashboard

Search queries inside Google Analytics dashboard

GA4: Track search events

When a user performs a search plugin send custom event aws_search with parameters to your GA4 property.

Here is the exact details that the plugin is send with each search query:

Event name: aws_search

Event parameter:

aws_search_term - current search term
aws_form_id - current form ID ( only for PRO version )
aws_form_filter - current filter name ( only for PRO version )

To view this event with additional parameters inside the GA4 dashboard we first need to properly configure this custom event tracking.

Start tracking search events

Here are the steps to enable tracking for aws_search event with custom parameters:

1. Open your GA4 property admin page and then go to Events page.

Events admin page

Events admin page

2. Click create event page. Then create a new event with the following parameters:

event_name -> equals -> aws_search

Also make sure that checkbox Copy parameters from the source event are checked.

Create new aws_search event

Create new aws_search event

When you are finished - click Save button.

3. Now we need to create a custom definition to track all search terms that are related to our aws_search event. First open Custom Definitions page.

Custom Definitions admin page

Custom Definitions admin page

4. Inside this page click Create custom dimension button. Then create a new dimension with the name aws_search_term, scope - Event and event parameter - aws_search_term. Then save all changes.

Creating new custom dimension

Creating new custom dimension

5. We are finished setting up our GA4 custom event and event parameters. Now we need to wait for some time until GA4 has accumulated some data on search queries from your site. It is best to wait one day.

Afterwards we need to display these events inside the GA4 dashboard. How to do that described in the next section.

GA4: Search events dashboard

Now, after we set up custom events and dimensions, it is time to view all this data inside the GA4 dashboard.

We will cover two ways of how to view such custom search events - via default Events report or by creating custom events exploration.

Option 1: Events report

All custom events tracking can be found inside Engagement -> Events page.

Open this page and click on aws_search event name to view only data related to this event.

aws_search event inside Events page

aws_search event inside Events page

On the aws_search page you can find analytics data for these events for a specified period of time.

We can find such data like total number of events, total number of users associated with this event, users country, etc.

aws_search event page

aws_search event page

Also at the bottom of the page we can find data about search terms - aws_search_term dimension. It is very useful if we need to know what users are searching for on the site.

aws_search_term dimension

aws_search_term dimension

As we see this custom event report can contain a lot of useful information. But it had its limits. If you need to build more advanced reports for search events then take a look on custom exploration.

Option 2: Custom events exploration

Here we will cover a more advanced way of tracking search queries by creating custom GA4 exploration.

1. Go to the GA4 Explore page and create a new blank report.

2. For Dimensions field choose previously created aws_search_term dimension.
For Metrics field use Event count.
For Segments create new segments that include all aws_search events.
Then on the right tab for Rows option choose aws_search_term value. And for the Values option choose Event count.

If you did everything fine then you will see a table with data about every search query of your site.

GA4 search terms report

GA4 search terms report

Custom analytics events

In addition to Google Analytics events, the Advanced Woo Search plugin also triggers an awsAnalytics js event with custom parameters on every successful user search.

This event is triggered even if Use Google Analytics option is turned off.

You can use this custom event to send your own custom events to Google Analytics per each search. Or send event data to any other third-party analytics tools.

Here is how you can use awsAnalytics js event to send custom events to GA4:

1. Open the functions.php file in your child theme or use any plugin for adding custom code snippets.

2. Add the following php code:

add_action( 'wp_footer', function () { ?>
    <script>
        jQuery(document).on('awsAnalytics', function (e) {

            window.dataLayer.push({
                'event' : 'my_custom_aws_event',
                'search_term': e.detail.term
            });

        });
    </script>
    <?php
}, 100 );

this code sends my_custom_aws_event event with custom parameter search_term to your GA4 property.

Customize this code any way that you want.

Additional custom data that you can use:

e.detail.term - current search term
e.detail.filter - current search form filter ( only for PRO version )
e.detail.form - jQuery object of current search form
e.detail.data - contain other additional options related to current search form

Old Google Analytics ( prior to GA4 )

Go to Google Analytics admin screen -> 'View Settings' for the view that you want to enable site search feature. Turn on Site search Tracking optional.
Then find Query parameter option and set string s for it.

Site Search Settings

Site Search Settings

Also if you have PRO plugin version you can enable Site search categories optional and set string awscat as its value.

Site search categories optional

Site search categories optional

Plugin uses Google Analytics Site Search dashboard to display its search queries. So just go to Behavior -> Site Search to view search queries dashboard.

Site search report

Site search report

Here you can find all search queries made with the Advanced Woo Search plugin. Also ajax search and search that was performed on separate pages are divided ( ajax search in reports has ajax-search: string in the beginning ).

Also with PRO plugin version it is possible to separate search queries by categories. Categories here will mean search form instance and filter that was used for search.

Search custom events

Additionally, the plugin sends GA custom events that can be found in Behaviour -> Event tab.

Events for search queries will have:

Event Category = AWS search

Event Action = AWS Search Term

Event Label = search query

Don't forget that Google Analytics has some delay between action and its display on GA dashboard.