Overview
Split automatically captures whenever an impression occurs for a split feature flag. Learn more about impression events.
To power analytics and experimentation, you need to send a broader set of events to Split. You can measure customer behavior and customer experience in your application by sending events such as clicks, views, checkout events, page load time, or any other event that measures behavior or experience.
Event data can be sent to Split in one of three ways:
- Call Split's SDK
track
method (example below) - Post a JSON body to Split's
events
API - Integrate with Segment
The API and integration routes allow you to ingest event data from existing sources (i.e. take advantage of telemetry from existing instrumentation or analytics). Use the track
method if you want to explicitly add instrumentation code to your application to record events.
Events can then be aggregated to produce metrics. Learn more about creating a metric in Split.
Track
Use the track
method to record any actions your customers perform. Each action is known as an event
and corresponds to an event type
. Calling track
through one of our SDKs or via the API is the first step to getting experimentation data into Split and allows you to measure the impact of your splits on your users’ actions and metrics.
In the examples below you can see that the .track()
method can take up to five arguments. The proper data type and syntax for each are:
- key: The
key
variable used in thegetTreatment
call and firing this track event. The expected data type is String. - TRAFFIC_TYPE: The traffic type of the key in the track call. The expected data type is String. You can only pass values that match the names of traffic types that you have defined in your instance of Split.
- EVENT_TYPE: The event type that this event should correspond to. The expected data type is String. Full requirements on this argument are:
- Contains 63 characters or fewer.
- Starts with a letter or number.
- Contains only letters, numbers, hyphen, underscore, or period.
- This is the regular expression we use to validate the value:
[a-zA-Z0-9][-_\.a-zA-Z0-9]{0,62}
- VALUE: (Optional) The value to be used in creating the metric. This field can be sent in as null or 0 if you intend to purely use the count function when creating a metric. The expected data type is Integer or Float.
- PROPERTIES: (Optional). A Map of key-value pairs that can be used to filter your metrics or used for the value in sum and average metrics. Learn more about event property capture here. Split currently supports three types of properties: strings, numbers, and booleans.
Here is an example track
call.
// If you would like to send an event without a value
boolean trackEvent = client.track("key", "TRAFFIC_TYPE", "EVENT_TYPE");
// Example
boolean trackEvent = client.track("john@doe.com", "user", "page_load_time");
// If you would like to associate a value to an event
boolean trackEvent = client.track("key", "TRAFFIC_TYPE", "EVENT_TYPE", VALUE);
// Example
boolean trackEvent = client.track("john@doe.com", "user", "page_load_time", 83.334);
// If you would like to associate a value and properties to an event
boolean trackEvent = client.track("key", "TRAFFIC_TYPE", "EVENT_TYPE", VALUE, {PROPERTIES});
// Example
HashMap<String, Object> properties = new HashMap<>();
properties.put("package", "premium");
properties.put("admin", true);
properties.put("discount", 50);
boolean trackEvent = client.track("john@doe.com", "user", "page_load_time", 83.334, properties);
Visualize in Split
Track events are listed on the Event Types tab in Admin Settings. New event types and corresponding events are shown here as they are received by Split.
You can update an event type's name and description via the API.
Click View to the right of an event type to see all of the corresponding events. On the Initial Web Load Time screen, you can investigate the event payload to that ensure the data is being received properly.
Comments
0 comments
Please sign in to leave a comment.