On this page

Data Mapping

Map columns from your data warehouse to Statsig events, user IDs, and properties so ingested data flows into metrics and experiment analysis correctly.

How data mapping works

Data mapping matches the columns in your data warehouse output to the fields Statsig expects, so ingested data flows into your metrics and experiment analysis. Statsig supports three types of datasets:

  1. Custom Events
  2. Precomputed Metrics
  3. Exposure Events

During setup, map your columns to the fields Statsig expects for one of these dataset types. Statsig runs a sample query to check for issues with data types, the mapping, or the base query.

Statsig casts fields into the appropriate type. For example, Statsig accepts string IDs, but also accepts an ID field left as an integer.


Custom events

Your application sends custom events to measure the ongoing impact of your features and experiments.

Required

Optional

An example dataset for events might look like this:

Custom events have the following characteristics:

  • One user can send multiple of the same event, with or without any changes in metadata. Statsig aggregates these together.
  • You can send metadata in both of a json-formatted (only one-level deep) string, and/or pull in fields from columns. You can use metadata and values to generate custom metrics in the console, like sum(value) where "product_category"="clothing".
  • You can send multiple IDs on a single event. For example, the visit event in the example dataset counts for both user and visit level metrics and experiments. During the mapping flow, specify which unit types your different IDs correspond to in Statsig.

Precomputed metrics

Use precomputed metrics to send complex metrics, or metrics that require delays due to attribution windows or long baking periods, to Statsig for experiment results.

Statsig expects precomputed metrics at a user-day granularity.

Required

An example dataset for metrics might look like this:

Precomputed metrics have the following characteristics:

  • In this dataset, unit types are in different rows from each other.
  • Metrics can either have a value or a numerator/denominator pair. Statsig calculates any metric with a numerator/denominator pair as a ratio metric. Ratio takes priority over value; if you provide all 3 fields, Statsig treats it as a ratio metric.
  • For users with null values, Statsig infers 0 for metric_value, and excludes null value users for ratio metrics.

Exposure events

Exposure event import is deprecated. If this is an important use case, refer to Statsig Warehouse Native, available to Enterprise customers.

Your assignment tool generates exposure events when it assigns users to a variant of an experiment (for example, show ad vs. hide ad).

Required

Optional

Was this helpful?