Conversion Tracking Using Advanced Editor

 

There are 3 main types of conversion goals:

  1. Page – counts the number of visitors or page views on a specific URL or group of URLs.
  2. Click – counts the number of clicks on a pre-defined html element.
  3. Custom Data – records the value attached to a specific conversion event or goal.

 

Page Load Conversion

A page load conversion counts the number of visitors or page views on a specific URL or group of URLs.

Adding a Page Load Conversion using the user interface:

  • During the test set up process, you can add page load conversion at step 4 “Goals”.
  • Enter conversion “Name” (E.g. Page_Confirmation)
    • We recommend using the “Page” prefix and avoid using spaces, apostrophes or special characters where possible.
  • Select “Page Load Conversion” from the ‘Type’ drop-down field.
  • Select a ‘Location’ from the drop-down field.

For further help on locations>>

1b)Adding a Page Load Conversion using custom code in the post-rendering script:

  • During the test set up process, you can add page load conversions in step 2 “Test Details” by adding custom code to the post-rendering script.
  • Click “Edit” within the ‘Post-Rendering Script’ section.

  • Add the following custom code into the ‘Post-Rendering Script’ window:

 

WT.addEventHandler(‘pageview’, function(e)

{

If(window.location.href.match(/www.yoursite.com/)) {

WT.click( {conversionPoint: conversionName});

}

});

  • Replace /www.yoursite.com/ with the URL page(s) in RegEx format.
  • Replace conversionName with a meaningful conversion name (E.g. Page_Confirmation).
    • We recommend using the “Page” prefix and avoid using spaces, apostrophes or special characters where possible.
  • Click “Audience” to save and proceed to the next step of the test set up.

 

Click Conversions

A click conversion counts the number of times a specific html element is clicked E.g. text link, button.

Adding a Click Conversion using custom code in the post-rendering script:

  • During the test set up process, you can add Click conversion goals at step 2 “Test Details” by adding custom code to the post-rendering script.
  • Click “Edit” within the ‘Post-Rendering Script’ section. (as above)
  • In order to track using JavaScript the platform has the function WT.click. Note syntax, case and that a colon is required after each.

WT.click({testAlias: value1,conversionPoint: value2,cookieInspection: “value3”,beacon:value4,data: value5});

Parameters

  • testAlias: The Test Alias is automatically generated when you create a new test and can be found in the ‘Project Details’ section.
    • Replace value1 with your Test Alias name.
  • conversionPoint:
    • This defines the label that will be given to the specific conversion point. Avoid using spaces, apostrophes or special characters where possible.
    • Replace value2 with a meaningful conversion name (E.g. Click_Button)
  • cookieInspection: Defines if the cookie is inspected before the conversion is sent.
    • Replace value3 with “False” or “True”
  • Beacon: Defines if Beacon mode is required.
    • Replace value4 with “False” (default) or “True”
  • Data: This function defines if custom data is required to be collected as the event is fired.
    • Replace value5 with data if no additional data collection is required.

Example in JS

document.getElementById(“YOUR_ID”).addEventListener(“click”, function(){

WT.click({testAlias: “TA_Mytest”,conversionPoint: “Click_BuyNow”,cookieInspection: false,beacon: false

})

Example using Jquery.

$(“body”).on(“click”, “.YOUR_CLASS“, function(){

WT.click({testAlias: “TA_Mytest”,conversionPoint: “Click_BuyNow”,cookieInspection: false, beacon: false});

});

Tips and troubleshooting

 

You may need to check that Jquery has loaded and the element available before click is executed. Wrapping the function into a routine that polls for the class (.classname) or an id (#idname). will avoid this occurrence.

intvl = setInterval(funciton(){

if(typeof window.jQuery === ‘function’ &&

window.jQuery(‘.YOUR_CLASS|#YOUR_ID‘).length) {

clearInterval(intvl);

}

}, 500);

On click conversions that take the visitor to new page in the same window, the event may be fired as the visitor is being redirected to another page. This can result in an event not being passed. Adding a small delay to the click event will avoid this being a possibility.

For mobile and touch devices, on.touch rather than on.click for the event trigger will in many cases be more robust.

 

Custom Data Conversions

A custom data conversion records a specific value attached to a pre-defined event or goal every time it is triggered. E.g. Transaction Value = £200.

  • During the test set up process, you can add ‘Custom data’ conversion goals at step 2 “Test Details” by adding custom code to the post-rendering script.
  • Click “Edit” within the ‘Post-Rendering Script’ section. (as above)
  • In order to track using JavaScript the platform has the function WT.click. Note syntax, case and that a colon is required after each.

 

WT.click( {

testAlias: alias,conversionPoint: conversionName,cookieInspection: false,beacon: false,data: {key:value}

});

  • Replace alias with your Test Alias name (see ‘Project Details’ section for Test Alias name).
  • Replace conversionName with a meaningful conversion name (E.g. Data_Transaction_Value).
  • Replace key:value with name and value of custom data variable.
  • Click to save and proceed to the next step of the test set up.
  • Contact your administrator to activate the conversion goal by creating a data table to store the custom data.