Tag events
Describes event tags and how to implement them in Optimizely Full Stack Flags release.
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 key | Description |
---|---|
revenue | An integer value that is used to track the revenue metric for your experiments, aggregated across all conversion events. Note:
|
value | A floating point value that is used to track a custom value for your experiments. Use this to pass the value for numeric metrics. Note:
|
Updated 5 months ago