Skip to main content

Everything you need to switch from Optimizely Classic to X in one place: See the Optimizely X Web Transition Guide.

Optimizely Knowledge Base

Numeric metrics

  • Evaluate when to use numeric metrics vs revenue metrics
  • Add code to send your numeric metrics results
  • Identify use cases where numeric metrics can impact your business

With numeric metrics, you can quantify visitor actions beyond conversions and revenue. By selecting the total value numerator and editing a few lines of code, you can track the performance of your different variations on any visitor action that can be described numerically per conversion, per session (Personalization), or per visitor (Full Stack, Mobile, and Web Experimentation).

As with the other metrics, total value is a single-average metric. Optimizely calculates the metric by first summing up all values we received for a given event (e.g., the sum of number of items purchased) and then dividing by the number of visitors, sessions, or conversions to calculate the final metric value.

I am unclear whether this information should be removed or simply moved. See this Google Doc for the discussion.

Adding numeric metric code

To build a numeric metric, follow the steps in the Build a Metric section of the Create a Metric in Optimizely X page. Once you are ready to add code, use the reserved value tag along with the name of your event.

Code in Optimizely X Web

If you are using Optimizely X Web, add a small snippet of code to your site to call Optimizely's event tracking API. Place this code on the pages where the event occurs.

   // Defines the optimizely object globally
   window["optimizely"] = window["optimizely"] || [];
   // Sends a tracking call to Optimizely for the event
     "type": "event",
     "eventName": "Videos Watched", // The name of your event
     "tags": {
       "value": 4 // The "value" tag, make sure to pass the value as a number data type

Code in Optimizely X Full Stack, Mobile, and OTT

If you are using Optimizely X Full-Stack, Mobile, or OTT, include the value tag when tracking an Optimizely event. Here's an example of what that might look like if you were using our JavaScript SDK.

var eventKey =  "Videos Watched";     // Name of your event
var userId =    "";

var attributes = {
  DEVICE:       "iPhone"

var eventTags = {
  category:     "videos",
  value:        4                     // The "value" tag

// Include revenue among other event tags when submitting Events
optimizely.track(eventKey, userId, attributes, eventTags);

Numeric metrics vs revenue metrics

We don't recommend using 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. When tracking monetary values, we recommend using the revenue metric to prevent these rounding errors.