To integrate your search with Google Analytics, you need to enable the integration in the app and configure it in your Google Analytics dashboard.
Enabling Google Analytics integration in the app settings
Go to your AddSearch Dashboard and switch the toggle for Google Analytics integration:

Note that you need to do it for the Widget and Search results page views separately if you are using both.
Depending on how you serve your analytics, you might need to configure it in the Google Analytics console only or in the Google Tag Manager as well.
- Google Analytics
- Google Tag Manager
Google Analytics (GA4)
Because AddSearch utilises search-as-you-type functionality, you need to disable the default Site search tracking in your Google analytics. Follow the instructions to do that:
- Log in to your Google Analytics account
- Click on Admin icon, located in the bottom left-hand corner
- Click on Data streams
- Select the GA4 property that you have installed on your website
- Click the gear icon under Enhanced measurement seciton
- Switch the Site search toggle off
See the screenshot for the correct settings:

If you serve your analytics through GA4 directly, you just need to enable GA integration in your AddSearch installation and you are done! Here is how the GA4 installation snippet looks like:
<!-- Google tag (gtag.js) -->
..
..
..
</script>
Google Tag Manager
If you are serving Google Analytics as a Google Tag Manager (GTM) tag, some additional steps are required for Google Analytics integration to work.
Set up variables
- Sign in to your Google Tag Manager account
- Click on Variables from the left-hand side menu
- Under User-Defined Variables, click New
- Click on the variable configuration and choose Data Layer Variable
- Enter “view_or_click” under “Data Layer Variable Name”
- Click Save and enter view_or_click as a name for the variable

Create two more variables, search_term and num_results, following the same steps. You should have three new variables once this step is finished.

Create a trigger
- Sign in to your Google Tag Manager account
- Click on Triggers from the left-hand side menu
- Click on the New button
- Click on the trigger configuration and choose Custom Event
- Enter view_search_results under “Event name”
- Click Save and enter view_search_results as a name for the trigger

Create a tag
- Sign in to your Google Tag Manager account
- Click on Tags from the left-hand side menu
- Select the New option
- Click on the trigger configuration and choose view_search_results trigger created in the previous step
- Click on the tag configuration and select Google Analytics: GA4 Event
- Open the Select Configuration Tag… menu and choose an existing tag or “Manually Set ID” if you don’t have any in the dropdown list
- If you choose the “Manually Set ID” option, enter your GA4 Measurement ID that has the following format: G-XXXXXXXXXX
- Enter view_search_results under the “Event name”
- In the event parameters, you need to enter three previously created variables as shown in the screenshot
- Then click Save and use view_search_results as the tag name

Publish your changes, and the search events should start showing in your Google Analytics account. Here is how the tag configuration should look like once the setup is complete:

Let us know if you liked the post. That’s the only way we can improve.