The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev guideRecipesAPI Reference
Dev guideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Tag events

Describes event tags and how to implement them in Optimizely Feature Experimentation.

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

  • Enrich your exported Optimizely Feature Experimentation experiment data. For example, you can reconcile Optimizely Feature Experimentation data with data from other company's systems. You may want to attach additional metadata tags such as a product SKU, product category, order ID, and purchase amount for a product purchase event.
  • Use reserved tag keys to track additional metrics on the Reports page.

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.

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

👍

Beta

Event properties and the reserved tag key,$opt_event_properties, are currently in beta.

The following are 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.

  • revenue – An integer value that is used to track the revenue metric for your experiments, aggregated across all conversion events.

    📘

    Note

    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.

  • 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

    Unlike revenue metrics, which use fixed-point numbers, numeric metrics use floating-point numbers.

    For example, $72.81 would be submitted as 7281 withrevenue, 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, use the revenue tag to prevent rounding errors.

  • $opt_event_properties – A map of default and custom event properties and their values. Event properties let you attach additional information to an event. You can add information about a product or action performed to create a more specific metric when using the event in the experiment results. See Event properties.