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:
enable google analytics integration in the dashboard

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.

  1. Google Analytics
  2. 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:

  1. Log in to your Google Analytics account
  2. Click on Admin icon, located in the bottom left-hand corner
  3. Click on Data streams
  4. Select the GA4 property that you have installed on your website
  5. Click the gear icon under Enhanced measurement seciton
  6. Switch the Site search toggle off

See the screenshot for the correct settings:
google analytics addsearch setup

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

  1. Sign in to your Google Tag Manager account
  2. Click on Variables from the left-hand side menu
  3. Under User-Defined Variables, click New
  4. Click on the variable configuration and choose Data Layer Variable
  5. Enter “view_or_click” under “Data Layer Variable Name”
  6. Click Save and enter view_or_click as a name for the variable

picture of user defined variable view_or_click.
Create two more variables, search_term and num_results, following the same steps. You should have three new variables once this step is finished.
picture of user defined variable view_or_click.

Create a trigger

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

picture of user defined variable view_or_click.

Create a tag

  1. Sign in to your Google Tag Manager account
  2. Click on Tags from the left-hand side menu
  3. Select the New option
  4. Click on the trigger configuration and choose view_search_results trigger created in the previous step
  5. Click on the tag configuration and select Google Analytics: GA4 Event
  6. 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
  7. If you choose the “Manually Set ID” option, enter your GA4 Measurement ID that has the following format: G-XXXXXXXXXX
  8. Enter view_search_results under the “Event name”
  9. In the event parameters, you need to enter three previously created variables as shown in the screenshot
  10. Then click Save and use view_search_results as the tag name

picture of user defined variable view_or_click.
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:
picture of user defined variable view_or_click.

Was this helpful?

Need more help?

We’re always happy to help if you couldn’t find an answer in our documentation. Feel free to contact our support or connect with the sales team.