How to locate IDs for the Optimizely Web Experimentation and Optimizely Feature Experimentation APIs

  • Updated

This topic describes how to:

Find the required IDs for the Event API and REST API for Optimizely Web Experimentation and Optimizely Feature Experimentation projects.

When using the Optimizely Experimentation APIs you will need several identifiers found in the Optimizely Experimentation application.

For example:

Depending if you are using an Optimizely Web Experimentation or Optimizely Feature Experimentation project, the information is found in different locations within the Optimizely Experimentation application. 

Optimizely Web Experimentation projects

Account ID

Go to Account Settings > Plan. The Account ID (account_id) is found at the top of the page to the right of the Account Information section.

account-ID_WEB.png

Campaign ID, Experiment ID, Variation IDs, Entity IDs and keys

Go to the project you will be sending events for. Click Experiments > [your experiment name] > API Names.

Event API variable

Name on page

Where to find in the UI

campaign_id

Campaign ID

Under the Experiment Details section.

experiment_id

Experiment ID 

Last ID in the Experiment Details section.

variation_id

[your variation names] 

In the Variations section. 

The variation_id is shown as the ID below the name of each variation.

entity_id

[your event names]

In the last section, named Events. 

The entity_id is listed as the ID below the name of each Event. It is to the left of the API Name.

key

Events > API Name

In the last section, named Events. 


The key is listed as the API Name below the name of each Event. It is to the right of the event ID.

The following screenshot highlights each ID shown on the API Names page.

api-names.png

Optimizely Feature Experimentation projects

You will find the IDs you need for the Optimizely Experimentation APIs inside your project's datafile, which is a JSON file. 

Account ID in Optimizely Feature Experimentation

Account ID is available in your datafile and in the Account Settings within the Optimizely Experimentation application.

Go to Account Settings > Plan. The Account ID (account_id) is found at the top of the page to the right of the Account Information section.

full-stack-account-id.png

Campaign ID, Experiment ID, Variation IDs, Entity IDs and keys

To access your project's datafile:

  1. Navigate to the project you are targeting.

  2. Go to the Settings dashboard and navigate to the Environments tab.

  3. Select the .json link for the specific Environment you want to view (Development or Production).
  4. This will open your datafile in a new tab. 

flags-datafile-location.png

The variable names in the datafile are slightly different than those in the Event API JSON object. 

To map the Event API fields to the datafile variables:

Event API Variable Name

Datafile Variable Name

Datafile Variable Parents

account_id

accountId

None

campaign_id

layerId

experiments >

experiment_id

id

experiments >

variation_id

id

experiments > variations

entity_id

id

events >

key

key

events >

 

In non-legacy Optimizely Feature Experimentation projects created after February 2021, find the experimentId in the project's datafile.

Examine this sample project datafile. These are the values mapped to the API variables.

  • account_id9367106729 (line 114)
  • campaign_id1363949190 (line 20)
  • experiment_id (multiple):
    • 4381824755 (line 18)
    • 8403352966 (line 46)
    • 8404883348 (line 74)
  • variation_id(multiple): 
    • 6404851286 (line 10)
    • 4429569305 (line 14)
    • 6848562798 (line 38)
    • 1647531815 (line 42)
    • 5895524347 (line 66)
    • 8404413532 (line 70)
  • entity_id(multiple):
    • 6431058684 (line 105)
    • 2491806650 (line 110)
  • key(multiple): 
    • ADD_TO_CART (line 106)
    • COMPLETED_PURCHASE (line 111)