Dev guideAPI Reference
Dev guideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Send Optimizely Data Platform data using Real-Time Segments for Feature Experimentation for the JavaScript (Browser) SDK

Use the sendOdpEvent method to send Optimizely Feature Experimentation event data to the Optimizely Data Platform (ODP) server.


You must configure Real-Time Segments for Feature Experimentation integration before sending events to ODP from Feature Experimentation.

JavaScript (Browser) SDK Version



The Optimizely Client extension method sendOdpEvent lets you send data to the ODP server. You can then use this data to analyze user behavior and optimize experiences across different channels and touchpoints.

Use the sendOdpEvent method to

  • Merge or stitch users together and determine which event is associated with which customer.
  • Send various types of events and actions, such as pageviews, clicks, form submissions, and others. You can include additional data to provide more context and information about the event being tracked.

For example, by connecting an email address identifier with a fs_user_id identifier, you can use the sendOdpEvent method to send events that are associated with both identifiers. This enables you to track and analyze the behavior of a specific user across different touchpoints and devices.

You cannot create or update user profile data like name or address with sendOdpEvent. Instead, you can use the ODP Create and update customers API endpoint or ODP UI to manage customer profiles.

Sending events to Optimizely Data Platform

The JavaScript (Browser) SDK discards the event immediately if there are any errors(sdkNotReady, odpNotIntegrated, or odpNotEnabled).


This table lists the required and optional parameters for the sendOdpEvent method.

StringSpecifies the subcategory of the event type, which will be used to track the app and user lifecycle.
typeStringThe type of event to be sent. Will be "fullstack" for all JavaScript (Browser) SDK-generated events if not specified.
identifiersMap<string, string>A key-value map of user identifiers. The JavaScript (Browser) SDK will add the vuid key-value pair to this optional user-provided identifiers.
dataMap<string, unknown>The event data in a key-value map. The value can be any type (string, number, or boolean.) Null values are allowed but will be interpreted as empty strings.

The JavaScript (Browser) SDK will add default event data to the given data dictionary. The default data values can be overwritten by sending the same key when creating your dictionary.

  • "idempotence_id":<UUID created by the JavaScript (Browser) SDK>

  • "data_source_type":"sdk"

  • "data_source":"javascript-browser-sdk"

  • "data_source_version":<JavaScript-Browser SDK version implemented>


This method sends event data to Optimizely Data Platform (ODP). It does not provide return values.


Method signature for sendOdpEvent:

sendOdpEvent(action: string, type?: string, identifiers?: Map<string, string>, data?: Map<string, unknown>): void;

const identifiers = new Map([["fs_user_id", "user123"], ["email", "[email protected]"]]);
const data = new Map([["count", 1]]);

try {
  optimizelyInstance.sendOdpEvent("purchased","fullstack", identifiers, data);
} catch (error) {
  // handle error here

The following diagram shows the network calls between your application, the JavaScript (Browser) SDK, and the ODP server when calling the sendOdpEvent method:

JavaScript (Browser) SDK sendOdpEvent network diagram
  1. Your application calls the sendOdpEvent method.
  2. The JavaScript (Browser) SDK makes a POST request to ODP.
  3. ODP responds with acknowledgment or relevant error.

Source files

The language and platform source files containing the implementation for JavaScript (Browser) are available on GitHub.