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 Ruby SDK

Describes the send_odp_event method, which sends Optimizely Feature Experimentation event data to the Optimizely Data Platform (ODP) server.

Prerequisites

You must configure Real-Time Segments for Feature Experimentation before sending events to Optimizely Data Platform (ODP) from Feature Experimentation.

Minimum SDK Version

5.0.0

Description

The Optimizely Client extension method send_odp_event 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 send_odp_event 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 send_odp_event 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 send_odp_event. 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

πŸ“˜

Note

The Ruby SDK discards the event immediately if there are any errors.

Parameters

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

ParameterTypeDescription
typeStringThe type of event to be sent. Is "fullstack" for all Ruby SDK-generated events if not specified.
action
required
StringSpecifies the subcategory of the event type used to track the app and user lifecycle.
identifiersHash<String, String>A key-value map of user identifiers. At least one key-value pair is required.
dataHash<String, Any>The event data in a key-value map. The value can be any type (string, number, or boolean.) You can use null values, but they become empty strings.

The Ruby SDK adds default event data to the given data dictionary. Sending the same key when creating your Hash overwrites the default data values.

  • "idempotence_id":<UUID created by the Ruby SDK>

  • "data_source_type":"sdk"

  • "data_source":"ruby-sdk"

  • "data_source_version":<Ruby SDK version implemented>

Returns

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

Example

identifiers = {
  'fs-user-id' => 'user123',
  'email' => '[email protected]'
}
data = {
  'item' => 'shirt',
  'price' => 50.00
}

optimizely.send_odp_event(type: 'purchased', action:'fullstack', identifiers: identifiers, data: data)

The following diagram shows the network calls between your application, the Ruby SDK, and the ODP server when calling the send_odp_event method:

send_odp_event network diagram
  1. Your application calls the send_odp_event method.
  2. The Ruby 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 Ruby are available on GitHub.