> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Experimentation and metric events

> This topic explains Experimentation and metric events and how they work.

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

## Overview

This topic explains Experimentation and metric events and how they work.

## About Experimentation and metric events

An "event" happens when someone takes an action in your app, such as clicking on a button, or when a system takes an action, such as loading a page. Your SDKs send these events to LaunchDarkly, which aggregates and analyzes them.

There are two kinds of events associated with experiments and metrics:

* **Evaluation events**: your SDKs send `feature` evaluation events to LaunchDarkly when an end user or other context interacts with a flag included in a running experiment.
* **Metric events**: your SDKs send `click`, `page view`, and `custom` metric events to LaunchDarkly when an end user or other context interacts with a part of your app you're tracking with a metric. To learn more, read [Events](/home/metrics/metric-events).

Here are examples of each event kind:

<CodeGroup>
  ```json title="Clicked or tapped metric event" theme={null}
      {
        "kind": "click",
        "key": "<internal id, not used>",
        "url": "https://example.com/",
        "creationDate": 16420388151234,
        "selector": "button.click-track"
        "contextKeys": {
          "user": "Sandy",
          "anonymousUser": "123213421231"
        }
      }
  ```

  ```json title="Custom conversion binary metric event" theme={null}
      {
        "kind": "custom",
        "key": "example-event-key",
        "creationDate": 16420388151234,
        "contextKeys": {
          "user": "Sandy",
          "anonymousUser": "123213421231"
        }
      }
  ```

  ```json title="Feature evaluation event" theme={null}
      {
        "kind": "feature",
        "creationDate": 1462220944000,
        "key": "example-flag-key",
        "variation": 0,
        "variationName": "my variation",
        "value": false,
        "default": false,
        "version": 42,
        "reason": {
          "inExperiment": "true"
        },
        "prereqOf": "example-prereq-flag-key",
        "contextKeys": {
          "user": "sandy",
          "anonymousUser": "123213421231"
        }
      }
  ```
</CodeGroup>

### The SDK "track" method

Server-side, client-side, and mobile LaunchDarkly SDKs send `custom` metric events when you call the SDK's track method.

<Card
  icon={<img src="https://fern-image-hosting.s3.us-east-1.amazonaws.com/launchdarkly/terminal.svg" class="terminal" />

}
  iconPosition="left"
>
  Try it in your SDK: [Sending custom events](/sdk/features/events)
</Card>

In addition, the JavaScript SDK also sends a `click` metric event when an end user clicks or taps on a page URL or anchor tag that you have included in a [clicked or tapped metric](/home/metrics/click), and sends a `page view` metric event when an end user visits a URL that you have included in a [page viewed metric](/home/metrics/pageview).

To learn how to view a list of all of the metric events your SDKs are sending to LaunchDarkly, read [Viewing incoming events](/home/metrics/view-incoming-events). This list shows a historical view of all events received over the last 90 days and is useful for choosing the right events to use in your metrics.

You can also view metric events on the [**Live events**](/home/releases/live-events) page using the **Experiments** filter. The Live events page displays events as they arrive in real time, and can act as live debugging tool while you develop your event tracking code.

If you prefer to import metric events from your existing data pipeline, read [Importing metric events](/home/metrics/import-events).

### Evaluation events

Server-side, client-side, and mobile LaunchDarkly SDKs send a `feature` event when you call the SDK's `variation` method to evaluate a flag in an experiment. To learn more about the `variation` method, read [Evaluating flags](/sdk/features/evaluating).

The JavaScript SDK and most JavaScript-based SDKs also send a `feature` event when you call the SDK's `allFlags` method, unless you configure it not to. The exception to this is the React Web SDK, which does not send an event by default when you call the `allFlags` method. To learn more about events in the React Web SDK, read [Events](/sdk/client-side/react/react-web#events).

Configuring the JavaScript SDK and JavaScript-based SDKs not to send `feature` events when you call `allFlags` limits the number of events these SDKs send to LaunchDarkly. To learn more about how SDKs send events, read [Analytics events](/sdk/concepts/events).

<Card
  icon={<img src="https://fern-image-hosting.s3.us-east-1.amazonaws.com/launchdarkly/terminal.svg" class="terminal" />

}
  iconPosition="left"
>
  Try it in your SDK: [Getting all flags](/sdk/features/all-flags#javascript)
</Card>

To learn more about evaluation and metric events, read [How to register custom conversion metric events in your experiment](https://support.launchdarkly.com/hc/en-us/articles/14526324522779-How-to-register-custom-conversion-metric-events-in-your-experiment).

## Events from external warehouses

You can connect LaunchDarkly to an external warehouse, such as Snowflake, and run experiments using events from that warehouse. To learn more, read [Snowflake native Experimentation](/home/warehouse-native/snowflake).

## Correlate variations and conversions

A conversion is when a user action provides a measurable value for a metric. For example, if a metric is tracking clicks on a checkout button, LaunchDarkly registers a conversion each time an end user clicks the button. The SDK sends a track call to register the conversion in LaunchDarkly.

LaunchDarkly uses variation calls to correlate the variation an end user received to a conversion within a 90-day window. If there are more than 90 days between the time of a variation call and a track call on a user key, then LaunchDarkly does not register the metric in the experiment.

<Card
  icon={<img src="https://fern-image-hosting.s3.us-east-1.amazonaws.com/launchdarkly/terminal.svg" class="terminal" />

}
  iconPosition="left"
>
  Try it in your SDK: [Evaluating flags](/sdk/features/evaluating), [Sending custom events](/sdk/features/events)
</Card>

In rare cases, unexpected behavior may cause an end user to receive multiple variations in the 90 days prior to a conversion. In these cases, LaunchDarkly attributes the conversion to the first variation the end user received in that 90-day period.
