As part of migration to our new decisioning engine, the "Velocity Templates" functionality has been deprecated.
All previously available ids, values and data is present and accessible in the following way:
var params = WT.optimize.lookup("ta_yourProjectAliasHere").params;
Your project alias can be found in the project details section of the test create/edit form.
Data Available
Template Name | Description |
params.r_experimentID | Experiment id |
params.r_runID | Experience id |
params.r_runState | Test State (ACTIVE etc) |
params.r_testID | Project id |
params.r_type | Test Type (target etc) |
params.testAlias | Project Alias |
params.s_mode | normal or staging |
Note that r_experimentID, r_runID and r_testID are number type values.
Examples of usage
Example One:
In this case data is being passed to a window variable called WT.variationData, which the site is expecting and will pick up and send to analytics.
It runs on initial execution of the test script as long as the element with class name 'navbar' is present.
(function(){
// Test Elements Selector
var testElement = window.document.querySelector('.navbar');
var params = WT.optimize.lookup("ta_abc123").params;
WT.variationData = WT.variationData || {tests:[]};
if (testElement) {
WT.variationData.tests.push({
alias: 'ta_abc123',
experimentId: params.r_experimentID,
testId: params.r_testID,
runID: params.r_runID,
type: params.r_type
});
}
})();
Example Two:
In this case, a helper function called logError passes caught script errors to GA's data layer.
(function (){
var params = WT.optimize.lookup("ta_abc123").params;
var logError = (error, source) => {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: "wto_interaction",
wto_type: "error || " + source,
wto_int_label: error.message,
wto_project_alias: 'ta_abc123',
wto_test_id: String(params.r_testID),
wto_experiment_id: String(params.r_experimentID)
});
};
try {
...execute some code
} catch (error) {
logError(error, 'runScript');
}
})();

