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

Dev guideRecipesAPI Reference
Dev guideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Send Optimizely Data Platform data using Real-Time Segments for Feature Experimentation for the C# SDK

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

Prerequisites

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

Minimum SDK Version

v4.0.0

Description

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 user data 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 endpointor ODP UI to manage customer profiles.

Sending events to Optimizely Data Platform

📘

Notes

  • The C# SDK discards the event immediately if there are any errors (sdkNotReady, odpNotIntegrated, or odpNotEnabled).
  • The C# SDK discards all events (implicit or explicit), with a warning log, requested before the datafile is ready. Ensure the datafile is fully ready in the C# SDK before you create user contexts and accept decision requests.

Parameters

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

ParameterTypeDescription
typestringThe type of event to be sent. It is "fullstack" for all C# SDK-generated events if not specified.
action
required
stringSpecifies the subcategory of the event type, used to track the app and user lifecycle.
identifiersDictionary<string, string>A key-value map of user identifiers. At least one key-value pair is required.
dataDictionary<string, object>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 C# SDK adds default event data to the given data dictionary. Sending the same key when creating your Dictionary overwrites the default data values.

  • "idempotence_id":<UUID created by the C# SDK>

  • "data_source_type":"sdk"

  • "data_source":"csharp-sdk"

  • "data_source_version":<C# SDK version implemented>

Returns

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

Example

var identifiers = new Dictionary<string, string>
{
    { "fs_user_id", "user123" },
    { "email", "[email protected]" }
};
var data = new Dictionary<string, object>
{
    { "item", "shirt" },
};

var optimizely = OptimizelyFactory.NewDefaultInstance("YOUR_SDK_KEY");
optimizely.SendOdpEvent(
    type: "purchased",
    action: "apparel",
    identifiers: identifiers,
    data: data);

The following diagram shows the network calls between your application, the C# SDK, and the ODP server when calling the SendOdpevent method:

c# SDK to ODP network diagram
  1. Your application calls the SendOdpEvent method.
  2. The C# SDK makes a request to ODP.
  3. ODP responds with acknowledgement or relevant error.

Source files

The language and platform source files containing the implementation for C# are available on GitHub.