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 a GTM account and you have created a container for your store. If not, please follow the guide here to do so.
When you login into your GTM account, you will see a list of containers. Select the container for which you want to integrate GA.
- Set up GTM Data Layer variable
- Go to Variables -> User-Defined Variables and then click on New
- Set up a variable for klevusearchterm
- You should now see the variable listed in the variables dashboard.
- Go to Variables -> User-Defined Variables and then click on New
- Set up GTM Virtual Pageview Trigger
- Go to the Triggers tab and then click on New
- Create the trigger as a custom event
- Go to the Triggers tab and then click on New
- 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 a GTM tag then
- Go to Tags and then click on New
- 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}}
- 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}}. Please note, if you do not see the "More Settings" option, select the "Enable overriding settings in this tag " checkbox.
- Fire On: Select “track klevu terms”
- Go to Tags and then click on New
- If you already have the tag for GA, please edit it as below:
- Publish changes