Overview
Split automatically captures whenever an impression occurs for a split feature flag. Learn more about impressions.
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 - Split integrations with Segment, mParticle, Sentry, Amazon S3, or Google Analytics
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.
Event fields
Each event contains these fields.
Field | Description |
---|---|
Environment ID and name | Environment where the event was captured. |
Event type ID | Event type that this event should correspond to. |
Foreign ID | Third party ID to identify this event if received via integration. |
Key | The key used customer firing the event. |
Properties | Map of key-value pairs that can be used to filter your metrics or used for the value in sum and average metrics. |
Reception timestamp | Time the impression was received by Split. |
SDK and version | Language and version of the SDK that was used to capture the event if using Split's track method. |
Source | Source of the event if captured via Split's RUM agent or through an integration. |
Timestamp | Time the event was captured. |
Traffic type ID and name | Traffic type of the key registering the event. |
Value | Value to be used in creating the metric |
Track Method
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
Event types can be found in admin settings. Delete an unneeded event type or view live tail to the right of an event type to view the raw events. Learn more about live tail in Split.
You can update an event type's name and description via the API.
Comments
0 comments
Please sign in to leave a comment.