What are Interaction Rates in WTO?
Interaction rates are similar to Exit/Bounce rates as they allow you to identify if a visitors journey ends after they are entered into a test or not.
Our WTO script creates a conversion point named engagement on the first page visited after a visitor is entered into a test.
Applying the below filter in a report will return users where the session ended on the test page
Whereas, applying the below filter would return visitors who have either refreshed the current page or move onto another page on the site.
How to enable Interaction Rates in WTO
Go to the tags page in your account - https://app.webtrends-optimize.com/optimize/tag/tags.
We recommend cloning the live tag first and testing the changes before updating your live tag. Find out more here.
Click on the Edit script option under Global Tag Script in your live tag.
Copy the below code
Interaction Rates script
Interaction Rates script
// Track Enagement rates
!function(){
WT.helpers.bdebug.log("WTO: Engagement tracking: START: ");
var key = "_wt.engagement";
var hass = WT.hasss;
var getRaw = function(){
return hass ? sessionStorage.getItem(key) : WT.helpers.cookie.get(key);
};
var get = function(ta){
WT.helpers.bdebug.log("WTO: Engagement tracking: Get: ", arguments);
var cur;
if(hass){
cur = JSON.parse(sessionStorage.getItem(key) || "{}");
} else {
cur = {};
var cookie = (WT.helpers.cookie.get(key) || "").split(".");
for(var i = 0; i < cookie.length; i++){
var parts = cookie[i].split(".");
cur[parts[0]] = parts[1];
}
}
return ta ? cur[ta] : cur;
};
var store = function(ta, val, fullObj){
WT.helpers.bdebug.log("WTO: Engagement tracking: Store: ", arguments);
var cur = fullObj || get();
var shouldUpdate = !!fullObj;
if(ta !== false && val !== false){
// Only make the update if value is 0 and it's not set to anything yet, or it's 1.
// This will prevent overwriting a 1 with a 0
if(val == 0 && !cur[ta] || val == 1){
cur[ta] = val;
shouldUpdate = true;
}
}
if(shouldUpdate){
if(hass){
sessionStorage.setItem(key, JSON.stringify(cur) );
} else {
var cookieval = [];
for(var c in cur){
cookieval.push(c + "." + cur[c]);
}
WT.helpers.cookie.set(key, cookieval.join("."));
}
}
};
// ---- On each page load
// Check existing tests
var list = get();
WT.helpers.bdebug.log("WTO: Engagement tracking: Onload list to check: ", list);
var toTrack = [];
for(var ta in list){
if(list[ta] == 0){
// Collect metric
toTrack.push(ta);
// Update number
list[ta] = 1;
}
}
if(toTrack.length){
WT.helpers.bdebug.log("WTO: Engagement tracking: Track Aliases: ", toTrack);
WT.CPCore.trackAliases(toTrack, [], {
name: "engagement",
}, {});
store(false, false, list);
}
// Hook into pageviews
WT.addEventHandler("pageview", function(e){
// Add to list
var ta = e.target.params.testAlias;
store(ta, 0);
});
}();
Search for the text processOptData(aEntry) and then place the script on the next line like below
If you are uncomfortable adding the script please raise a ticket via the ticketing portal and our team will help get this setup for you.
How does this script identify the interaction rates?
This script adds a cookie to a visitors Session Storage named _wt. engagement. This contains an object listing any tests they have been entered into and each test is given a value of 0 on the first pageview.
If the visitor refreshes the current page or visits a further page on the site then a conversion named engagement is sent for any tests stored that have a value of 0. The value of the stored test is then updated to 1 so no further engagement conversions are triggered.




