Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

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

Dev guideRecipesAPI ReferenceChangelog
Dev guideAPI ReferenceRecipesChangelogUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Recipes
GitHubDev CommunityOptimizely AcademySubmit a ticket

Optimizely developer documentation

How can we help you?

Try our conversational search powered by Generative AI!

AI OnAI Off

1. Create a flag and variables

Create a flag with four variables using the Create flag API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

IN THIS RECIPE
  1. Prerequisite
  2. Create file
  3. Configure the API call
🚩
1. Create a flag and variables

Create a flag with four variables using the Create flag API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

10 Steps
πŸ”„
2. Create variations

Create three example calls to the Create a New Variation API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

8 Steps
πŸ“Š
3. Create events

Create three example events using the Create a Custom Event API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

7 Steps
πŸ‘€
4. Create attributes

Create seven audience attributes using the Create an attribute API endpoint. Attributes are used to target your audiences.

Before running this request, follow the instructions to set up your REST API cookbook.

12 Steps
πŸ§ͺ
6. Create experiment

Create an A/B test to experiment if showing the number of items left in stock on the product detail page (PDP) will increase add-to-cart clicks using the Update the Ruleset for a Flag in an Environment API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

11 Steps
πŸ‘₯
5. Create audiences

Create six audiences to control who sees your flag rules using the Create an Audience API endpoint.

A single audience is defined based on custom user attributes you create.

Before running this request, follow the instructions to set up your REST API cookbook.

12 Steps
πŸš€
7. Launch experiment

Use the Enable the Ruleset for a Flag in an Environment to launch your A/B test.

Before running this request, follow the instructions to set up your REST API cookbook.

7 Steps
βœ…
8. Conclude experiment

Stop your flag and conclude your experiment using the Update the Ruleset for a Flag in an Environment API endpoint.

Before running this request, follow the instructions to set up your REST API cookbook.

10 Steps
πŸ”
9. Analyze results

Use the List rules, List reports, Fetch a Single Report, and the Get Experiment results API endpoints to get the A/B test's result.

Before running this request, follow the instructions to set up your REST API cookbook.

7 Steps