Total value and other numeric metrics

  • Updated
  • Optimizely Web Experimentation
  • Optimizely Web Personalization
  • Optimizely Performance Edge
  • Optimizely Feature Experimentation
  • Optimizely Full Stack (Legacy)

Optimizely Experimentation's total value metric is a flexible numeric metric that lets you track actions beyond conversions and revenue. As long as it is quantifiable, you can use total value to track it.

Add the tracking call in Optimizely Web Experimentation

When using total value as your numerator, you must add some JavaScript to your experiment or campaign in Optimizely Web Experimentation. When you are ready to add code, use the reserved value tag.

Add a small code snippet to your site to call the event tracking API. Place this code on the pages where the event occurs.

window["optimizely"] = window["optimizely"] || [];
window["optimizely"].push({
  "type"     : "event",
  "eventName": "Videos Watched",  //this refers to the API name of the event
  tags"      : {
                 "value": 4                   
               }
});

Add the tracking call in Optimizely Feature Experimentation

In Optimizely Feature Experimentation, include the reserved value tag when tracking an event. The following code shows an example of what it might look like if you use the Optimizely Feature Experimentation JavaScript SDK.

var eventKey = "Videos Watched";     
var userId = "auser@adomain.com";

var attributes = {
  DEVICE: "iPhone"
};

var eventTags = {
  category: "videos",
  value: 4                     
};

// Include revenue among other event tags when submitting Events
user.trackEvent('my_purchase_event_key', eventTags);

Value metrics and revenue metrics 

You should not use total value metrics to track monetary values.

Unlike revenue metrics, which use fixed-point numbers, numeric metrics use floating-point numbers. For example, $72.81 would be submitted as 7281 with revenue but as 72.81 with value. Due to the dynamic precision of floating-point numbers, aggregations for numeric metrics are susceptible to rounding. You must use the revenue metric to prevent these rounding errors when tracking monetary values.