Experiments

Create metric

Create a metric. The metric's type is derived from the aggregation shape: a numerator alone is SIMPLE, a numerator with a denominator is RATIO, and a percentile aggregation is PERCENTILE. Warehouse aggregations reference measures by UUID. Property filters use property_id or measure_id UUIDs returned by the same metric SQL model; every reference must belong to the aggregation's data source. The is_certified attribute is rejected. Certification cannot be changed through this endpoint.

post/api/v2/experiments/metrics

Request

Request body

Example request

{
  "data": {
    "attributes": {
      "data_source_type": "CUSTOMER_WAREHOUSE",
      "description": null,
      "desired_change": "METRIC_INCREASES",
      "format_as_percent": true,
      "guardrail_cutoff_threshold": null,
      "name": "Checkout conversion",
      "numerator_aggregation": {
        "operation": "sum",
        "property_filters": [
          [
            {
              "operation": "IS",
              "property_id": "550e8400-e29b-41d4-a716-446655440023",
              "values": [
                "US"
              ]
            }
          ]
        ],
        "timeframe_start_value": 0,
        "warehouse_metric_measure": {
          "id": "550e8400-e29b-41d4-a716-446655440021"
        }
      }
    },
    "type": "metrics"
  }
}

Response

Created

Example response

{
  "data": {
    "attributes": {
      "created_at": "2024-01-01T12:00:00Z",
      "data_source_type": "CUSTOMER_WAREHOUSE",
      "description": "Share of sessions that reach the order confirmation page",
      "desired_change": "METRIC_INCREASES",
      "format_as_percent": true,
      "metric_type": "SIMPLE",
      "name": "Checkout conversion",
      "numerator_aggregation": {
        "operation": "sum",
        "pipeline_column_suffix": "agg001",
        "timeframe_start_value": 0,
        "warehouse_metric_measure": {
          "id": "550e8400-e29b-41d4-a716-446655440021",
          "pipeline_column_suffix": "rev001"
        }
      },
      "reference_url": "",
      "updated_at": "2024-01-01T12:00:00Z"
    },
    "id": "550e8400-e29b-41d4-a716-446655440002",
    "type": "metrics"
  }
}

Changes

Changes to this operation have not been checked yet.