# Optimizely Data Platform Destination

## Destination Info

* Accepts [Page](/docs/segment/connections/spec/page), [Alias](/docs/segment/connections/spec/alias), [Group](/docs/segment/connections/spec/group), [Identify](/docs/segment/connections/spec/identify), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **Optimizely Data Platform** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)
* This integration is **partner owned.** Please reach out to the partner's support for any issues.
* This destination is **Beta.**

Sync your Twilio Segment customer data to Optimizely Data Platform (ODP) for real-time segmentation, reporting, and to enrich customer profiles in ODP.

After you set up your Optimizely Data Platform destination, Segment syncs your customer data to ODP in near real-time.

This destination is maintained by Optimizely. For any issues with the destination, [contact Optimizely Support team](mailto:support@optimizely.com).

## Prerequisites

* Twilio Segment workspace
* ODP or [ODP Lite](https://support.optimizely.com/hc/en-us/articles/8359093735309-Welcome-to-ODP-Lite) account

## Enable the integration

1. In ODP, open the **App Directory**.
2. Select the **Twilio Segment** app.
3. Click **Install App**.
4. On the Settings tab, click **Generate** and copy the displayed token.
5. Open the Segment app and navigate to the [Destination catalog page](https://app.segment.com/goto-my-workspace/destinations/catalog).
6. Search for and select **Optimizely Data Platform**.
7. Click **Add destination** and select a source to connect to the Optimizely Data Platform destination.
8. Enter a name for your destination and click **Create destination**.
9. On the destination's Settings tab, enter the following information:
   * **Api Key** – Paste your ODP API token from step 4
   * **Region** – Select your region
   * **Enable Destination** – Toggle to **On**
10. Click **Save Changes**.

## Configure event mappings

After you enable the Optimizely Data Platform destination, you must map the events that you want Twilio Segment to send to ODP.

In Twilio Segment, on the **Mappings** tab of the Optimizely Data Platform destination, Segment displays a list of pre-built mappings that you can enable or disable. For example, if you enabled the **Email Opened** mapping, each email opened event Segment ingested after you enabled the mapping would sync to ODP.

If you want to map an event that is not listed:

1. Click **New Mapping > Custom Event**.
2. *(Optional)*: Enter a descriptive name for the event.
3. Select the event that you want to send to ODP.
4. Click **Load Test Event from Source**. This generates the raw data for the selected event and populates your mappings. The ID and timestamp field mappings auto-populate, but you can edit them as desired.
5. Select the event type and, optionally, the event action. For example, if you are configuring a custom event to track button clicks, select *button* for the event type and *click* for the event action.

> \[!NOTE]
>
> In ODP, each event requires an ID, timestamp, and event type. The event action is optional. See ODP's [Events](https://docs.developers.optimizely.com/optimizely-data-platform/docs/thebasics-events) documentation for more details.

6. *(Optional)*: To ensure the custom event is configured correctly, click **Send test event to destination**.
7. Click **Save**.
8. Toggle your custom event's status to **Enabled**.

The event data sends from Twilio Segment to ODP starting after you enable the mapping in the destination. It does not retroactively send events that occurred prior to configuring the integration and enabling the mappings.

## Destination Settings

| Field   | Description                                                       | Required | Type     |
| ------- | ----------------------------------------------------------------- | -------- | -------- |
| Api Key | Api Key used for Optimizely API authorization when sending events | Yes      | password |
| Region  | Optimizely Region to sync data to. Default is US                  | Yes      | select   |

## Available Presets

Optimizely Data Platform has the following presets

| Preset Name          | Trigger                                                 | Default Action  |
| -------------------- | ------------------------------------------------------- | --------------- |
| Email Link Clicked   | Event type = "track" and event = "Email Link Clicked"   | Email Event     |
| Email Opened         | Event type = "track" and event = "Email Opened"         | Email Event     |
| Product Added        | Event type = "track" and event = "Product Added"        | Ecommerce Event |
| Order Completed      | Event type = "track" and event = "Order Completed"      | Ecommerce Event |
| Email Sent           | Event type = "track" and event = "Email Sent"           | Email Event     |
| Product Removed      | Event type = "track" and event = "Product Removed"      | Ecommerce Event |
| Email Marked as Spam | Event type = "track" and event = "Email Marked as Spam" | Email Event     |
| Product Viewed       | Event type = "track" and event = "Product Viewed"       | Ecommerce Event |
| Unsubscribed         | Event type = "track" and event = "Unsubscribed"         | Email Event     |

## Available Actions

Build your own Mappings. Combine supported [triggers](/docs/segment/connections/destinations/actions/#components-of-a-destination-action) with the following Optimizely Data Platform-supported actions:

> \[!NOTE]
>
> Individual destination instances have support a maximum of 50 mappings.

* [Upsert Contact](#upsert-contact-2)
* [Email Event](#email-event)
* [Ecommerce Event](#ecommerce-event)
* [Custom Event](#custom-event)

### Upsert Contact

Send user profile data from Segment to Optimizely Data Platform. Creates or updates a user profile in Optimzely Data Platform

Upsert Contact is a **Cloud** action. The default Trigger is `type = "identify"`

| Field                | Description                                         | Required | Type     |
| -------------------- | --------------------------------------------------- | -------- | -------- |
| User identifiers     | User identifier details to send to Optimizely.      | Yes      | OBJECT   |
| Company Name         | The name of the company associated with the Contact | No       | STRING   |
| Title                | The Contact's Title                                 | No       | STRING   |
| Name                 | Contact's full name                                 | No       | STRING   |
| First Name           | Contact's first name                                | No       | STRING   |
| Last Name            | Contact's last name                                 | No       | STRING   |
| Gender               | Contact's gender                                    | No       | STRING   |
| Birthday             | Contact's birthday. The format should be datetime   | No       | DATETIME |
| Phone                | Contact's phone number.                             | No       | STRING   |
| Age                  | Contact's age.                                      | No       | NUMBER   |
| Address              | Address details object                              | No       | OBJECT   |
| avatar               | The user's avatar image URL.                        | No       | STRING   |
| Addition User Traits | Additional user profile details                     | No       | OBJECT   |

### Email Event

Send email related Segment track() events to Optimizely Data Platform

Email Event is a **Cloud** action.

| Field                   | Description                                     | Required | Type   |
| ----------------------- | ----------------------------------------------- | -------- | ------ |
| User identifiers        | User identifier details to send to Optimizely.  | Yes      | OBJECT |
| Optimizely Event Action | The name of the Optimizely Event Action.        | Yes      | STRING |
| Campaign Name           | The campaign name                               | Yes      | STRING |
| Campaign ID             | The campaign unique identifier                  | No       | STRING |
| Link URL                | URL of the link which was clicked               | No       | STRING |
| Timestamp               | Event timestamp                                 | Yes      | STRING |

### Ecommerce Event

Send Segment Ecommerce track() events to Optimizely Data Platform

Ecommerce Event is a **Cloud** action.

| Field                   | Description                                                                                | Required | Type   |
| ----------------------- | ------------------------------------------------------------------------------------------ | -------- | ------ |
| User identifiers        | User identifier details to send to Optimizely.                                             | Yes      | OBJECT |
| Optimizely Event Type   | The Optimizely Event Type. Defaults to "custom" if not provided                            | No       | STRING |
| Optimizely Event Action | The name of the Optimizely Event Action.                                                   | Yes      | STRING |
| Product details         | Product details to associate with the event. Product ID field is required for each product | No       | OBJECT |
| Order ID                | Identifier for the order                                                                   | No       | STRING |
| Order Total             | Total value of the order                                                                   | No       | STRING |
| Timestamp               | Event timestamp                                                                            | Yes      | STRING |

### Custom Event

Send Segment custom track() events to Optimizely Data Platform

Custom Event is a **Cloud** action.

| Field                   | Description                                                     | Required | Type   |
| ----------------------- | --------------------------------------------------------------- | -------- | ------ |
| User identifiers        | User identifier details to send to Optimizely.                  | Yes      | OBJECT |
| Optimizely Event Type   | The Optimizely Event Type. Defaults to "custom" if not provided | No       | STRING |
| Optimizely Event Action | The name of the Optimizely Event Action.                        | No       | STRING |
| Event Properties        | Additional information to send with your custom event           | No       | OBJECT |
| Timestamp               | Event timestamp                                                 | Yes      | STRING |

## Engage

You can send computed traits and audiences generated using [Engage](/docs/segment/engage) to this destination as a **user property**. To learn more about Engage, schedule a [demo](https://segment.com/contact/demo).

For user-property destinations, an [identify](/docs/segment/connections/spec/identify/) call is sent to the destination for each user being added and removed. The property name is the snake\_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property `order_completed_last_30days: true`. When the user no longer satisfies this condition (for example, it's been more than 30 days since their last order), Engage sets that value to `false`.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

> \[!NOTE]
>
> Real-time audience syncs to Optimizely Data Platform  may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field   | Description                                                       | Required | Type     |
| ------- | ----------------------------------------------------------------- | -------- | -------- |
| Api Key | Api Key used for Optimizely API authorization when sending events | Yes      | password |
| Region  | Optimizely Region to sync data to. Default is US                  | Yes      | select   |
