TL;DR
- LaunchDarkly now supports filters for Custom Metric Events, letting you define multiple metrics filtered to specific metadata from a single event key.
- This simplifies event instrumentation: send us a generic event payload and create more specific metrics directly in LaunchDarkly.
- Filtered metrics can be used in experiments or Guarded Releases with no additional setup.
Introducing filters for Custom Metric Events
Being data-driven often requires granular measurement of the impact or metrics you’re optimizing against, such as when you’re measuring the impact of a new feature across different pages. But developers shouldn’t have to instrument several versions of the same event just to get granular insights.
That’s why we’re excited to announce filters for Custom Metric Events. Filters let you create different metrics from a single event based on event and context metadata. Using filters can help you capture granular, actionable insights while keeping your event instrumentation simple.
Granular metrics without the event sprawl
When you run an experiment or deploy a Guarded Release, you might want to test a result for a specific part of your user base, or a particular event property. Until now, analyzing metrics with granularity often meant creating multiple events for each dimension: for example, an error event per page type or a conversion event per region.
Filters for Custom Metric Events simplifies this by letting you use a single, generic event and apply filters in LaunchDarkly during metric creation. You can filter on the metadata of the event itself, or on attributes of the context associated with the event. You can filter using multiple logical statements, giving you the maximum flexibility to create the metric you want and reducing the number of events you have to instrument and manage.
How filters for Custom Metric Events work
You can add filters for custom metric events directly in the Metric Creation flow. When creating a metric, you can filter by:
- Context-level attributes: Attributes tied to the context, such as region.
- Event-level attributes: Metadata associated with the event itself, such as page type or a SKU included in the value field of a custom event.
Multiple filters can be added to a metric definition for greater granularity, giving you significant flexibility in how you define your metric.
Example: How to set up filters for Custom Metric Events
Let’s say you’re managing an e-commerce website, and you want to know what effect a release has on the error rates of several different pages. Instead of sending a separate error event for each page, you can instrument a generic error event using the ldtrack() method and include metadata for the page name:
const ldClient = useLDClient(); ldClient.get().track("error_event_key",{page_name: "checkout"});
Copied!
Then, you can create separate metrics in LaunchDarkly using the Create Metrics flow:
Why filters for Custom Metric Events matter
Here are three benefits of using this new feature:
- Less instrumentation, less overhead. Avoid duplicating events for each dimension you want to track. Instead of logging
error_cart, error_checkout
, anderror_login
, just senderror_event
and filter it to create custom metrics in LaunchDarkly. - Faster, more targeted experimentation. Filters let you run experiments on specific slices of your user base for more granular insights
- More scalable analytics. As your product grows, so does the complexity of your metrics. Filters let you update your metric definitions with flexible AND and OR statements across both context attributes and event properties.
Filters for Custom Metric Events are now available for all LaunchDarkly customers to use in both Guarded Releases and Experiments.