---
title: Optimizely
description: The Optimizely app adds a field type for selecting Optimizely audiences, so blocks can target content by segment.
url: https://www.storyblok.com/docs/apps/optimizely
---

# Optimizely

The Optimizely app adds a field type that lists the audiences of a connected [Optimizely](https://www.optimizely.com/) project. Store an audience ID on a block to build A/B tests and show content to one segment of your audience.

## Features

-   Select an Optimizely audience from within Storyblok.
-   Build A/B tests around the stored audience IDs.
-   Show a block only to the audience it targets.

## Setup

1.  In Optimizely, create a user with read-only access and generate an OAuth token in the account settings.
2.  Install the Optimizely app from the app directory.
3.  In the **Block Library**, add a field to a block, set its field type to **Plugin**, and select `optimizely-v2` as the custom type.
4.  Enter the Optimizely OAuth token and project ID in the field options.

## Content structure

To show user-specific content, create an `AbTest` block with a segment field of the Optimizely plugin type and a body field of type **Blocks**. When your frontend iterates over the content blocks, it decides which block to render based on the selected audience.

The recommended content structure:

-   Block: `Page`
    -   Field: `Body` (Blocks)
        -   Block: `AbTest`
            -   Field: `Segment` (Optimizely plugin)
            -   Field: `Body` (Blocks)
        -   Block: `AbTest`
            -   Field: `Segment` (Optimizely plugin)
            -   Field: `Body` (Blocks)

## Further resources

[Optimizely in the app directory](https://www.storyblok.com/apps/optimizely)

## Pagination

-   [Previous: Netlify Builds](/docs/apps/netlify-builds)
-   [Next: Palette](/docs/apps/palette)
