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’:

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

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

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

 

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:

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’:

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

Make a 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.

8

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

.click(function (event) {
_mktz.push(['_Goal','bannerclicks','VALUE']); 
(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:

Screenshot_221 

  1. Save the changes and publish the experiment.
  2. 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.