This guide provides instructions for integrating Google Analytics with Klevu search using Google Tag Manager

This guide assumes that you’re already set up with GTM account and you have created a container for your store. If not, please follow the guide here to do so: https://support.google.com/tagmanager/answer/6103696?hl=en

When you login into your GTM account, you will see a list of containers.
No Image
Select the container for which you want to integrate GA.

  1. Set up GTM Data Layer variable
    • Go to Variables -> User-Defined Variables and then click on New
      No Image
    • Set up a variable for klevusearchterm
      No Image
    • You should now see the variable listed in the variables dashboard.
      No Image
  2. Set up GTM Virtual Pageview Trigger
    • Go to Triggers tab and then click on New
      No Image
    • Create the trigger as a custom event
      No Image
  3. Set up GTM Virtual Pageview Tag
      Now we need to configure a GTM tag, which is the link between GTM and Google Analytics so that the data can actually be logged.

    • If you don’t have GTM tag then
      • Go to Tags and then click on New
        No Image
      • Set the following details
        • Set the tag name
        • Choose Product: Select Google Analytics
        • Choose a Tag Type: Select Universal Analytics (or Classic if you’re still using it)
        • Configure Tag:
              • Insert your GA linking information (Tracking id)
              • Track Type: Page View
              • More settings -> Fields to set
                    • page : {{klevusearchterm}}

                No Image

          Please note that if you already have other fields set in “Fields to set” section, just add a new field for “page” and set its value to {{klevusearchterm}}

        • Fire On: Select “track klevu terms”
          No Image
    • If you already have the tag for GA, please edit it as below:
      No Image
  4. Publish changes