Product analytics events
Overview
This topic describes how to use LaunchDarkly’s product analytics events with observability features to help you understand how system performance affects user activities in your application.
By default, the JavaScript client-side SDK observability plugin automatically records the following product events as OpenTelemetry spans:
- Page clicks, with details about the click location and URL.
- Page views, including the current and previous URLs.
- Custom metric events that your code generates using the
track()method. The span events fortrack()calls include both the product URL and metric event key, as well as any optional numeric value provided for a numeric event.
All of the span events generated for these product analytics also include information about the LaunchDarkly context that generated the event. You can use the context attributes to associate product usage events with other observability data, such as errors and log messages, to better understand how overall system performance affects user activities in your application.
Prerequisites
To use LaunchDarkly’s automatic instrumentation for product analytics events, you require:
- The client-side JavaScript SDK, version 3.7.0 or later.
- The observability plugin for JavaScript. You can also use the session replay plugin, but it is not required to generate product analytics events. The session replay plugin is required if you want to create a heatmap to display click data over a session background.
- For metric event analytics, your code should use the
track()method to generate LaunchDarkly metric events. To learn more, read Sending custom events.
By default, the observability plugin for JavaScript automatically generates span events for clicks, page views, and custom metrics. You can choose to disable collecting all or some product analytics events by configuring the plugin options. To learn more, read Configure product analytics event collection.
Product analytics event attributes
Each product analytics event generates an OpenTelemetry span with a span_name attribute that describes its type: click, page_view, or launchdarkly.track. You can use the span name or other span attributes to filter product analytics events on the Traces page, or to create charts for observability dashboards.
All product analytics events include one or more context.contextKeys.<context_name> attributes that provide the context keys that generated the event. All events include an http.url attribute that provides the full application URL that generated the event.
Some events include additional, event-specific attributes that describe characteristics of the event or user interaction:
- Click events can include multiple attributes prefixed with
event.that describe details of the click location (event.xandevent.y) or the clicked element (event.tag,event.text,event.xpath). - Page view events include both the URL of the page viewed and the previously-visited URL in the
page.view.urlandpage.view.previous_urlattributes. - Track events include the metric event key in the
keyattribute.
Because product analytics events are implemented as OpenTelemetry spans, each event also includes common span attributes to indicate factors such as the span duration, whether the span includes errors, and so forth. To learn more, read Search attributes.
Using product analytics events
LaunchDarkly product analytics let you easily visualize common product usage events alongside system-level observability measurements, such as errors, logs, and other trace spans. The primary method for associating analytics with system performance is by adding time series charts or funnel charts for product analytics events alongside other observability charts.
Observability funnel charts provide the ability to filter on different product analytics events during chart setup.

For other graph types, you can use query parameters with even span attributes to filter as necessary to the events you want to visualize.

To learn more, read Custom dashboards.