At Klevu, often, we are asked if our customers can perform A/B testing to check if the Klevu Search is better than their existing search solution. What the customers usually want to know is how much the Klevu Search is helping them in search led conversions.
Google Tag Manager (aka GTM), is one of the popular tools that allow you to monitor consumer activities on a website, including what they search, click and buy. From the GTM’s perspective, monitoring such activities is a process called setting up “tags” in GTM. For the every tag setup in GTM, Google provides a snippet of code to be included on your website. This code is responsible for sending the required data to Google.
In this document, we provide information on setting up GTM to perform A/B testing for Klevu Search.
It is, basically, a three steps process:
- Setting up a Google Tag Manager (GTM) account
- Setting up GTM testing environment (i.e. obtaining snippets of codes to include on your website)
- Making minor changes to the Klevu Search codebase to enable/disable Klevu Search based on a parameter configured by the GTM code.
Setting up a Google Tag Manager account
- If you already have a GTM account, please login into it. Otherwise, please follow the steps mentioned here to create a new GTM account.
- Once the account is created, you need to add a container for your website. The container is just a collection of tags that you like to add to your website (e.g. for measuring analytics, adwords conversions, etc). Please follow the steps as mentioned here to create a new container for your website.
Setting up an A/B Test in GTM
- Login into your GTM account
- Choose the respective account for your website and the container
- Click on the tags > Add a new tag > Custom HTML Tag
- Under the "Configure Tag", paste the following code and click on the “Continue” button.
- Under the “Fire On” section, click on the “More” > “NEW” button
- A new window with the title "Create Trigger" will open. Here, under the "Choose Event" section, please click on the "Custom Event" button.
- Set the event name to call_gtmtesting.
- Click on the "filters" button and configure the condition as: event — equals — call_gtmtesting.
- Click on the "Create Trigger" and “Save Trigger” buttons.
- Click on the "Create Tag" button.
- Click on the “Save Tag” button.
- At this stage, please go to your google analytics account (i.e. https://analytics.google.com) and find out the google analytics code for your website. The code should look like UA-XXXXXXXX-X. You will need this in the next steps.
- Once you have the Google Analytics code, now is the time to configure parameters for your A/B test. Please go to http://abtestguide.com/gtmtesting/createtest.htmland fill up the details as described below.
- Test ID: eg: AB-Klevu01
- Test name: Klevu Search AB Test
- Description: Klevu Search Enabled
- Code: var klevu_search_disable=false;
- Description: Klevu Search Disabled
- Code: var klevu_search_disable=true;
- Analytics: Select the option “Universal Analytics”
- Property ID: here, provide your analytics code, the one you had copied from your google analytics account (e.g. UA - XXXXXXXX-XX).
- Event Category: AB Test
- Exposure Rate: 100%
- Traffic Control: 50% (Klevu search will be activated to 50% of your customers)
- Traffic Variation B: 50% (The other search option on your website will be activated to rest of the 50% of customers)
- Click on the Generate AB test Code button. This will generate a code at the bottom of the page. You need to copy this code and generate another tag in your GTM manager.
- Add another custom tag in your GTM account (i.e. Click on the tags > Add a new tag > Custom HTML Tag) and name it “GMT Testing”.
- Copy the code from step 14 and paste it in the HTML area of “Configure Tag”.
- Under the section “Fire On”, click on “More” > “New” > “Custom Event” and select the “Page View” option.
- Under the “Configure Trigger”, select the “DOM Ready” option.
- Under the “Fire On” section, select the “All Page Views” option and click on the “Create Trigger” button.
- Click on the “Create Tag” button.
- Make sure to publish your container by clicking on the “Publish” button at the top right corner of your page. This will make the test live on your website.
Changes in the Klevu’s code base
For the other session, it would be
Any questions or need any help? Please feel free to write to us at email@example.com