How to track clicks in an A/B test variation when the element triggers a Survey or Interaction

  • Home
  • Features
  • Goals
  • How to track clicks in an A/B test variation when the element triggers a Survey or Interaction

If you want to track clicks on a button that has been set to trigger a Survey or an Interaction on a page included in an A/B test, you need to follow these steps:

A. Create the Custom Goal

1. Go to ‘Dashboard’ > ‘Advanced’ > ‘Goals’ > ‘New goal’:

omniconvert new goal

2. Give a representative name to the goal and select “Custom” from the goal options. In our case we named it “bannerclicks”:

omniconvert custom goal type

3. Hit ‘Save’ and a custom code will be generated. This code should be copied in order to be used further in the process.

The custom goal is now created and can be reviewed in the Dashboard under the Goals section:

B. Add the goal into an A/B test

omniconvert add goal a b test

Add the goal to the A/B test experiment from the tab – ‘Traffic Allocation and Goals’:

a b test traffic allocation

Once you click on ‘Select or create a goal‘, a new window will appear. Here, you can select the goal created previously. In our case, the ‘bannerclicks’ goal:

omniconvert select goal

C. Integrate the custom goal code snippet into the object you desire to track

1. Go to the Variations tab, select the variation.

2. Click on the banner you wish to track the clicks for and use ‘Edit element’ > ‘HTML code’:

omniconvert edit element html

3. Add a small change to the script like a letter to the title or something and save the change.

omniconvert element change

4. Scroll over the variation name and click on “Code” option. You will see all the changes you’ve made so far, including the one with the letter added in the title.

omniconvert variation code
variation code dev

5. Select the part that comes after the   ).  and change it with this one:

.click(function (event) {
(new _mktzInteract()).track_click_safely(event, mktz_$(this)); 

Don’t forget to change the name in the code above from “bannerclicks” into the one you’ve added yourself.

Like we did in this picture:

variation code dev example

6. Save the changes and publish the experiment.

7. Test it to see if the goal tracking setup is working.

Attention: This setup will apply an on click goal tracking only for the Variation of the experiment. It will not track clicks for Control. 

Shopping Basket