Skip to main content
menu_icon.png

Everything you need to switch from Optimizely Classic to X in one place: See the Optimizely X Web Transition Guide.

x
Optimizely Knowledge Base

How to locate IDs for the Optimizely X Event API

There are two versions of Optimizely
What version do you have?
X
Optimizely Classic
This is what the Optimizely Classic user interface looks like.
Optimizely X
This is what the Optimizely X user interface looks like.
. If you're using Optimizely Classic, see our developer documentation.
relevant products:
  • Optimizely X Web
  • Optimizely X Full Stack
  • Optimizely X Mobile

THIS ARTICLE WILL HELP YOU:
  • Find IDs you'll need for the Optimizely X Event API for Web projects
  • Find IDs you'll need for the Optimizely X Event API for Full Stack and Mobile projects

When creating the JSON object that you use to send information to the Optimizely X Event API, you'll need several pieces of information found in the Optimizely web app. These pieces of information are found in different locations within the web app, depending on whether you are working in a Web project or a Full Stack or Mobile project.

Web projects

Account ID

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

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.

API variable

Name on page

How to find

campaign_id

Campaign ID

Upper-right

experiment_id

Experiment ID

Upper-right

variation_id

Variations > ID

In the first panel called Variations
The variation_id is shown as the ID below the name of each variation.

entity_id

Events > ID

In the final panel called Events
The entity_id 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 final panel called Events
The key is listed as the API Name below the name of each Event. It is to the right of the ID.

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

api-names.png

Mobile and Full Stack projects

You will find the IDs you need for the Event API inside the project's datafile, which is also a JSON file. The variable names in the datafile are slightly different than the names in the Event API JSON object.

Here's how to access your project's datafile:

  1. Navigate to the Settings dashboard and select the Datafile tab.

  2. Click View to open the CDN link for the JSON datafile.

Here's how to map the Event API variables to the datafile variables:

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 >

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)