Affected: All SDKs
Overview
If you are running experiments in LaunchDarkly, you can register custom conversion metric events to track contextual behavior and make data-driven decisions. By registering metric events, you can analyze the performance of different variations of your feature flag and optimize it accordingly.
Solution
To register events for metrics in experiments, you need two components: an Evaluation event, also known as a feature event, and a Metric event, also known as a custom event. Refer to the documentation of Experimentation events for more information.
variation()
or variationDetails()
methods. If you want to learn more about these methods, read Evaluating flags and Flag evaluation reasons.
track()
call. If you want to learn more about how to track, please read Sending custom events.flush()
method to send events immediately without waiting for the next interval. The flush()
call is an optional step that may or may not be required, depending on your application. If you'd like to learn more about the flush call, read Flushing events.Steps
-
Evaluate a feature flag (for example: 'flag-experiment') with the
variation()
method -
Associate a running experiment (for example: 'A/B Testing') with the feature flag
-
Connect a metric (for example: 'metric-ab-test') to the experiment with an event name (e.g., metric-event-name-ab-test)
-
Track the metric using the event name. For example
track('metric-event-name-ab-test')
-
[Optional]
flush()
call at the end
Resources