HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In
Hey! These docs are for version 2.1.0-full-stack, which is no longer officially supported. Click here for the latest version, 1.0!


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`.