September 28, 2017

Experiment Anywhere Using Our Event API

This is the 2nd of a series of 3 blog posts covering our APIs, read the first one on the REST API here. Recently, we announced several enhancements to Optimizely’s measurement capabilities. Today, we’ll focus on one of these enhancements, the Event API, which enables teams to send events via HTTP to Optimizely. With the


This is the 2nd of a series of 3 blog posts covering our APIs, read the first one on the REST API here.

Recently, we announced several enhancements to Optimizely’s measurement capabilities. Today, we’ll focus on one of these enhancements, the Event API, which enables teams to send events via HTTP to Optimizely. With the Event API, you can enable new measurement capabilities for platforms not supported via our client and server SDKs, track offline conversions related to online experiments, or send events where you have restrictions on using client-side JavaScript.

Currently, Optimizely offers multiple ways to send event data. Customers using web experimentation and personalization, can use the JavaScript snippet to track events in the client. Customers using Optimizely’s Full Stack can use its client and server-side SDKs to send events from a diverse number of platforms including web, mobile apps, TV apps, and even IoT devices like the Amazon Echo. While these solutions are designed to cover a wide variety of situations, there are still use cases such as offline conversions or times when you don’t have access to the conversion data at run-time in which the Event API is the better or only solution. In the following section, we’ll walk through some common use cases for the Event API.

Flexible for Any Use Case

Measuring Offline Conversions
For businesses that have conversions that occur offline with channels such as direct mail, phone, or in-person, the Event API can help them understand the impact of how online experiments translate to conversions in the real-world. For instance, a bank could run an experiment to increase the prominence of their home loan products on their website and measure whether it increases home loan applications at their retail branches.

Working with Security Constraints
Optimizely takes security very seriously and we’ve continued to invest in security and compliance standards including PCI compliance and SOC II certification. However, some companies may still have limitations on their ability to use 3rd party JavaScript on certain pages of their website. The Event API provides a secure way to track conversions without needing to load the JavaScript snippet.

Enriching Your Conversion Data
In some cases, your company may want to supplement its conversion data with third party data. One potential application would be a travel company that generates revenue through affiliate conversions. Their customers search for travel options on their site but then purchase on a third party site (See image below). When running an experiment to generate additional traffic to their partner sites, they might want to understand whether those clicks also resulted in conversions on their partner sites. The Event API would help you bring that data into Optimizely to understand the true impact of your experiment. You can also use this to bring in metrics such as lifetime value from third-party BI systems to better understand the longer term input of your experiments.

Example: Travel Site Can Track Conversions on an Affiliate Site with Event API

 

Improved Performance and Capabilities

We’ve made a number of enhancements to our Events API based on learnings from our original offline events API. We’ve added the capability to batch events and we’ve also improved the performance and reliability. Optimizely X Web Snippets can now be enabled to use the Event API via a new logging endpoint, which enables batching of events and control over event timing.

Customers who are using the new endpoint have already seen a substantial increase in performance. If you are interested in getting access to the improved snippet endpoint, just submit a request for access. To confirm what endpoint you are currently using you can refer to the following article. For customers using our Full Stack SDKs, we’re also planning on rolling out updates to support batching in the future.

Send an Event

To send an event, you’ll just do a POST request to the Event API endpoint and pass it a JSON data object that includes information about your account, experiment, variation, decision, conversion event, and the visitor. For more detailed instructions, you can view the API reference here.  

curl \
-A "test-user-agent"
-H "Content-Type: application/json" \
-X POST -d '{_data_object_}' https://logx.optimizely.com/v1/events
view raw
event-api.ssh
hosted with ❤ by GitHub

Decide if the Event API is Right for You

We’ve outlined a few potential use cases for the Event API and at this point you may be wondering when it makes sense to use the Event API vs. the existing JavaScript snippet and SDKs.  

As a rule of thumb, if you have access to the conversion information at run-time and do not have any security restrictions that prevent you from firing the event, sending events via the snippet or SDKs is likely easier to set up and the better option. However, if the conversion meets any of the following criteria: occurs offline, isn’t available at run-time, needs to be augmented with other data sources then the Event API is likely the better fit.

However, it’s not necessarily a binary choice. In many cases, you could use the Event API in tandem with sending events through the snippet and SDKs to take advantage of more advanced tracking scenarios such as sending revenue through the snippet and lifetime value via the Event API.

Getting Started

Using the Event API to send events is straightforward:

  1. If you haven’t switched to Optimizely X, you’ll need to upgrade to Optimizely X.
  2. Read our developer docs on the Event API
  3. Begin sending events!

Take your experimentation to the next level!