Access test and variation identifiers
Note
Experiment keys are unique within an Optimizely project, and variation keys are unique within an experiment. However, experiment keys and variation keys are not guaranteed to be universally unique because they are user-generated. This may become a problem in your analytics reports if you use the same key in multiple Optimizely projects or rename your keys.
For human-friendly strings when absolute uniqueness is not required, use keys. If you need to uniquely identify experiments and variations in a way that will not change when you rename keys, use the automatically generated IDs.
Android
Keys can be accessed on Experiment
and Variation
objects using getKey()
, and IDs can be accessed using getId()
.
Java
Keys can be accessed on Experiment
and Variation
objects using getKey()
, and IDs can be accessed using getId()
.
Objective-C
Keys and IDs can be accessed on OPTLYExperiment
objects using experimentKey
and experimentId
respectively. Likewise, keys and IDs can be accessed on OPTLYVariation
objects using variationKey
and variationId
.
Swift
Keys and IDs can be accessed on OPTLYExperiment
objects using experimentKey
and experimentId
respectively. Likewise, keys and IDs can be accessed on OPTLYVariation
objects using variationKey
and variationId
.
Updated 11 months ago