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

Send Optimizely Data Platform data using Advanced Audience Targeting for the Java SDK

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

👍

Beta

Advanced Audience Targeting is currently in beta. Apply on the Optimizely beta signup page or contact your Customer Success Manager.

Prerequisites

You must enable the Advanced Audience Targeting integration before sending events to ODP from Feature Experimentation.

Minimum SDK Version

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

Sending events to Optimizely Data Platform

📘

Note

  • The Java SDK discards the event immediately if there are any errors (sdkNotReady, odpNotIntegrated, or odpNotEnabled).
  • The Java SDK discards all events (implicit or explicit) with a warning log if requested before the datafile is ready. The datafile should be fully ready in the Java 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 and is "fullstack" for all Java SDK-generated events if not specified.
action
required
StringSpecifies the subcategory of the event type, used to track the app and user lifecycle.
identifiersHashMap<String, String>A key-value map of user identifiers. Must have at least one key-value pair.
dataHashMap<String, Any>The event data in a key-value map. The value can be any type (string, number, or boolean.) Although allowed, null values are empty strings.

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

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

  • "data_source_type":"sdk"

  • "data_source":"java-sdk"

  • "data_source_version":<Java SDK version implemented>

Returns

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

Example

sendODPEvent(String type, String action, Map<String, String> identifiers, Map<String, Object> data)

Map<String, String> identifiers = new HashMap<>();  
identifiers.put("fs_user_id", "user123");  
identifiers.put("email", "[email protected]");  
Map<String, Object> data = new HashMap<>();  
                data.put("item", "shirt");  
                data.put("price", 50.00);

optimizely.sendODPEvent("fullstack", "purchased", identifiers, data);

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

Java SDK network diagram for calling ODP
  1. Your application calls the sendODPEvent method.
  2. The Java SDK makes a POST request to ODP.
  3. ODP responds with acknowledgement or relevant error.

Source files

The language and platform source files containing the implementation for Java are available on Github.