Create your own - for users

Are you a user of Webtrends Optimize looking to send data to a 3rd party platform when people fall into your experiment?

Updated over a week ago

This document imagines sending data to an imaginary platform My Insights Platform (MIP). To send data to this platform, we will be using this fictitious code:

_mip_track = _mip_track || [];
_mip_track.push({
project_alias: projectAlias,
test_id: testID,
experiment_id: experimentID
});

There are a few different approaches to how we choose to integrate with other platforms for Push integrations:

  • Globally, for all tests by default

  • On a per-test basis, using a standard approach

  • On a per-test basis, if you're using the Optimize Build Framework.

Each of these will be explored below.

Globally, for all tests

The following code should be put in the preinit section of your tag:

WT.addEventHandler("pageview", function(e){
var params = e.target.params;
var projectAlias = params.testAlias,
testID = params.r_runID,
experimentID = params.r_experimentID || params.r_personalisedID || "BASELINE";

_mip_track = _mip_track || [];
_mip_track.push({
project_alias: projectAlias,
test_id: testID,
experiment_id: experimentID
});
});

On a per test basis, standard approach

If you only want to send the track request for a single test, you can take the above code and drop it into your test with a small difference.

The additional logic reads "only do this if it's for my project".

WT.addEventHandler("pageview", function(e){
var params = e.target.params;
var projectAlias = params.testAlias,
testID = params.r_runID,
experimentID = params.r_experimentID || params.r_personalisedID || "BASELINE";

if(projectAlias !== "ta_MyTest") return;

_mip_track = _mip_track || [];
_mip_track.push({
project_alias: projectAlias,
test_id: testID,
experiment_id: experimentID
});
});

On a per test basis, using the Optimize Build Framework

This is far simpler if you're using the OBF, as callbacks are already scoped to "this test" and all attributes are in one place. The code reduces to:

Test.event.bindAfter("pageview", function(){

var o = Config.velocityData;

_mip_track = _mip_track || [];
_mip_track.push({
project_alias: o.testAlias,
test_id: o.r_runID,
experiment_id: o.r_experimentID
});
});
Did this answer your question?