The plugin sends custom events to Google Analytics. There are two categories of events:
- Autocomplete Search with results
- Autocomplete Search without results
Table of Contents
Benefits
- 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.
- You can better understand your customers by analyzing what they type in the search engine.
- You can check which products are most often searched
- You can check which products aren’t searched and why
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:
- Open the
functions.php
file in your child theme and add the code at the end - Or 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.
More resources – https://www.analyticsmania.com/post/find-search-terms-in-google-analytics-4/