Google Analytics

The plugin sends custom events to Google Analytics. There are two categories of events:

  1. Autocomplete Search with results
  2. Autocomplete Search without results

Table of Contents

Benefits

  1. You can see all terms typed by users that don’t return products. To increase sales you have to correct the product names or descriptions to cover these terms.
  2. You can better understand your customers by analyzing what they type in the search engine.
  3. You can check which products are most often searched
  4. You can check which products aren’t searched and why

How to enable it?

This feature is enabled out of the box. It requires only the GA tracking code installed on your website.


Do you need more data for analysis?

Google Analytics has a special Site Search feature. The site Search feature lets you understand the extent to which users took advantage of your site’s search function, which search terms they entered, and how effectively the search results created deeper engagement with your site.

The site search feature requires your actions. You have to enable this module in GA and enable Site Search in the plugin also.

Enable Site Search in GA

1. Go to Admin screen

2. Open “View Settings” view

3. Enable “Site Search” module

4. Add “s” as a query parameter.

5. Save settings

Enable Site Search module in the FiboSearch

To add the code to your site, you can either:

  1. Open the functions.php in your child theme and add the code at the end
  2. Install the Code Snippets plugin and apply this code as a snippet.
/**
 * Enable Google Analytics Site Search module
 */
add_filter('dgwt/wcas/scripts/enable_ga_site_search_module', '__return_true');

Result

Disable sending any data to GA

To disable integrarion with Google Analytics use the following code either way:

  1. Open the functions.php in your child theme and add the code at the end
  2. Install the Code Snippets plugin and apply this code as a snippet.
/**
 * Disable sending data to Google Analytics
 */
add_filter('dgwt/wcas/scripts/send_ga_events', '__return_false');

Integration with Google Analytics 4

With its release in October, 2020, and further development ever since, it’s clear that Google Analytics 4 is the most future-proof tool. FiboSearch has not been fully integrated with GA4 yet, but we plan to do so ASAP.

Nevertheless, we’ve added a search event trigger to our plugin and you can use it to send events to GA4. 

During the search, the dgwtWcasGAEvent event is triggered and you can listen to it using the snippet below. 

To add the code to your site, you can either:

  1. Open the functions.php in your child theme and add the code at the end
  2. Install the Code Snippets plugin and apply this code as a snippet.
add_action( 'wp_footer', function () { ?>
    <script>

       jQuery(document).on('dgwtWcasGAEvent', function (event, data) {
            window.dataLayer.push({

               'event' : 'autocomplete_search',
                'searchTerm': data.term,
                'searchCategory': data.category,

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

}, 100 );

Next, you’ll have to configure GTM (Google Tag Manager) for the event to be passed on. 

  • Trigger
  • Variables
  • Tag

After saving and publishing changes to GTM, you’ll receive search events in GA4.