Analytics Ready-made View

AddSearch detects Google Analytics (GA) on your website and pushes search events there. Google Analytics integration is available to Professional, Premium, and Enterprise plans. 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
  3. Enabling GA integration

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 “search_or_click” under “Data Layer Variable Name”
  6. Click Save and enter search_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 search_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 search_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 search_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 search_or_click.

Enabling Google Analytics integration in your installation

If you use legacy ready-made views, the integration will be enabled in your AddSearch installation by default. For contemporary out-of-the-box views, after setting up Google integration in your Google Analytics dashboard you need to follow the steps below to enable Google Analytics integration in your installation using the AddSearch Search Designer. In case you are not sure which view is installed on your website or you have a custom implementation, contact our support and we will be happy to help.

  1. Open the AddSearch Search Designer here
  2. Enter your site key in the Site key input field to have access to your search index
  3. Choose the Widget or Search Results Page to choose the search view
  4. Click the Advanced button to open the advanced settings
  5. Toggle the checkbox in the Google Analytics Integration row to enable Google Analytics tracking
  6. Click Apply changes button to apply the changes

To get the installation script with Google Analytics enabled, follow these steps:

  1. Click the Installation Script button from the top right to open the search script
  2. Copy the script and add it to your website’s source code

Other Analytics Platforms

It is possible to integrate AddSearch with other platforms such as Adobe Analytics and Matomo (Piwik) using custom analytics events. Contact us at support@addsearch.com if you need help with the integration.

Was this helpful?

Need more help?

We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.