HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Tag events

Describes event tags and how to implement them in Optimizely Full Stack Flags version.

Use cases

Event tags are contextual metadata about conversion events. You can use event tags to:

  • Enrich your exported Optimizely experiment data. For example, you can reconcile Optimizely data with data from other company systems. For a product purchase event, you may want to attach additional metadata tags such as a product SKU, product category, order ID and purchase amount.
  • Track numeric metrics on the Reports page by using reserved tag keys.

Event tags do not affect audiences and, except for reserved tag keys, do not affect the Reports page. They do not need to be registered in the Optimizely app.

Implement tags

You can include event tags as an optional key-value argument when you call the Track Event method. Event tags are distinct from user attributes, which should be reserved for user-level targeting and segmentation. Event tags can be strings, integers, floating-point numbers or Boolean values.

See the following example:

user = optimizely.createUserContext(userId: "test-user", attributes: ["is_logged_in" : "true"])

var eventTags = Dictionary<String, Any>()
eventTags["category"] = "shoes"
eventTags["revenue"] = 6432  // reserved "revenue" tag in cents
eventTags["value"] = 4 // reserved "value" tag

// Track events with  event tags
try? user.trackEvent("my_conversion", eventTags:eventTags)

Reserved tag keys

The following table lists the reserved tag keys, which are included in their corresponding fields in the Optimizely Event API payload. They are bundled into event tags for your convenience. Use them if you want to benefit from seeing specific reporting features, such as revenue metrics or numeric metrics, on your Reports page.

Tag keyDescription
revenueAn integer value that is used to track the revenue metric for your experiments, aggregated across all conversion events.


- Revenue is recorded in cents; to record a revenue value of $64.32, use 6432.
- Add any event you want to track revenue for as a metric in your experiment.
valueA floating point value that is used to track a custom value for your experiments. Use this to pass the value for numeric metrics.


- We do not 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 tag to prevent these rounding errors.