Skip to main content

Get Available Metrics

Retrieve the list of available metrics you can track.
brand
string
required
The brand/project ID
split_test_id
string
Filter metrics relevant to split tests (optional)
Request
GET /api/brands/{brand}/analytics/metrics
cURL
curl https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics \
  -H "EF-Access-Key: your_api_key_here"
{
  "revenue": {
    "type": "revenue",
    "name": "Revenue",
    "base": "revenue",
    "color": "#10b981",
    "icon": "<svg>...</svg>",
    "info": "Total revenue from orders",
    "group_name": "Sales",
    "modules": ["conversions"]
  },
  "sales": {
    "type": "sales",
    "name": "Sales",
    "base": "sales",
    "color": "#3b82f6",
    "group_name": "Sales",
    "modules": ["conversions"]
  },
  "page_views": {
    "type": "page_views",
    "name": "Page Views",
    "base": "page_views",
    "group_name": "Traffic",
    "modules": ["tracking"]
  }
}

Get Metrics Data

Retrieve actual metrics values for a date range.
brand
string
required
The brand/project ID
start
string
required
Start date (ISO 8601 format)
end
string
required
End date (ISO 8601 format)
tz
string
Timezone (e.g., “America/New_York”)
selected_metrics
array
Array of metric keys to retrieve
filter[field]
string
Filter by specific field values (e.g., filter[aff_id]=123)
page_id
string
Filter by specific page
split_test_id
string
Filter by specific split test
engine
string
Analytics engine: elasticsearch or clickhouse (optional)
Request
GET /api/brands/{brand}/analytics/metrics/data
cURL
curl "https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics/data?start=2024-12-01T00:00:00Z&end=2024-12-10T23:59:59Z&selected_metrics[]=revenue&selected_metrics[]=sales&selected_metrics[]=page_views" \
  -H "EF-Access-Key: your_api_key_here"
{
  "revenue": {
    "value": 15750.00,
    "formatted_value": "$15,750.00",
    "previous_value": 12300.00,
    "change": 28.05,
    "change_symbol": "+",
    "current_range": "Dec 1 - Dec 10",
    "previous_range": "Nov 20 - Nov 30",
    "previous_range_label": "Previous Period",
    "lower_is_better": false,
    "neutral": false
  },
  "sales": {
    "value": 315,
    "formatted_value": "315",
    "previous_value": 246,
    "change": 28.05,
    "change_symbol": "+",
    "lower_is_better": false
  },
  "page_views": {
    "value": 10500,
    "formatted_value": "10,500",
    "previous_value": 8750,
    "change": 20.00,
    "change_symbol": "+"
  }
}

Get Analytics Cards

Retrieve specialized analytics cards data (video analytics, fulfillment metrics, etc.).
brand
string
required
The brand/project ID
start
string
required
Start date (ISO 8601 format)
end
string
required
End date (ISO 8601 format)
enabled_cards
array
Array of card types to retrieve
Request
GET /api/brands/{brand}/analytics/metrics/cards
cURL
curl "https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics/cards?start=2024-12-01T00:00:00Z&end=2024-12-10T23:59:59Z&enabled_cards[]=video_play_rate&enabled_cards[]=time_on_page_before_purchase" \
  -H "EF-Access-Key: your_api_key_here"
{
  "cards": {
    "video_analytics": {
      "video_play_rate": {
        "value": 0.65,
        "formatted_value": "65%"
      },
      "average_video_watch_time": {
        "value": 185.5,
        "formatted_value": "3:05"
      }
    },
    "advanced_metrics": {
      "time_on_page_before_purchase": {
        "value": 320,
        "formatted": "5:20",
        "sample_size": 315
      }
    }
  },
  "enabled_cards": ["video_play_rate", "time_on_page_before_purchase"],
  "filters_applied": {
    "date_range": ["2024-12-01T00:00:00Z", "2024-12-10T23:59:59Z"],
    "page_id": null,
    "split_test_id": null
  }
}

Get Grouped Metrics

Retrieve metrics grouped by a specific field (e.g., by product, page, affiliate).
brand
string
required
The brand/project ID
field
string
required
Grouping field: product, page, aff_id, day, hour, country, device, utm_source, etc.
start
string
required
Start date (ISO 8601 format)
end
string
required
End date (ISO 8601 format)
selected_metrics
array
Array of metric keys to retrieve
Request
GET /api/brands/{brand}/analytics/metrics/{field}/data
cURL
curl "https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics/product/data?start=2024-12-01T00:00:00Z&end=2024-12-10T23:59:59Z&selected_metrics[]=revenue&selected_metrics[]=sales" \
  -H "EF-Access-Key: your_api_key_here"
[
  {
    "row_key": "PROD-001",
    "row_name": "Main Product",
    "revenue": {
      "value": 9875.00,
      "formatted_value": "$9,875.00"
    },
    "sales": {
      "value": 198,
      "formatted_value": "198"
    }
  },
  {
    "row_key": "PROD-002",
    "row_name": "Upsell Product",
    "revenue": {
      "value": 5875.00,
      "formatted_value": "$5,875.00"
    },
    "sales": {
      "value": 117,
      "formatted_value": "117"
    }
  }
]

Export Grouped Metrics

Export grouped metrics to CSV or Excel.
brand
string
required
The brand/project ID
field
string
required
Grouping field
metrics
array
Array of metric keys to export
format
string
Export format: csv or excel (default: csv)
date_range
object
Date range object with start/end dates
Request
POST /api/brands/{brand}/analytics/metrics/{field}/export
cURL
curl -X POST "https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics/product/export" \
  -H "EF-Access-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "metrics": ["revenue", "sales", "aov"],
    "format": "csv",
    "date_range": {
      "start": "2024-12-01",
      "end": "2024-12-10"
    }
  }'
{
  "message": "Export has been queued. You will receive an email when it's ready.",
  "status": "queued",
  "field": "product"
}

Available Grouping Fields

  • hour - Hour of day (0-23)
  • day - Calendar day
  • week - Week number
  • month - Month
  • year - Year
  • hour_of_day - Time grouping
  • aff_id - Affiliate (requires permission)
  • subid - Sub ID
  • merchant_id - Merchant
  • page - Landing page
  • product - Product
  • funnel_id - Funnel
  • country - Visitor country
  • region - Visitor region
  • shipping_country - Shipping destination
  • shipping_state - Shipping state
  • device - Device type (desktop/mobile/tablet)
  • os - Operating system
  • browser - Browser type
  • screen_resolution - Screen size
  • language - Browser language
  • utm_source - Traffic source
  • utm_medium - Marketing medium
  • utm_campaign - Campaign
  • utm_term - Keyword/term
  • utm_content - Ad content
  • referrer - Referring website

Compound Grouping

You can group by multiple fields simultaneously using semicolon separation:
GET /api/brands/{brand}/analytics/metrics/product;page/data
This groups metrics by both product AND page.

Filtering

Apply filters using the filter[field] query parameter:
# Filter by affiliate
GET /api/brands/{brand}/analytics/metrics/data?filter[aff_id]=123

# Filter by device
GET /api/brands/{brand}/analytics/metrics/data?filter[device]=mobile

# Filter by country
GET /api/brands/{brand}/analytics/metrics/data?filter[country]=US

# Multiple filters
GET /api/brands/{brand}/analytics/metrics/data?filter[device]=mobile&filter[country]=US

Custom Metrics

You can create custom metrics using formulas:
cURL
curl "https://app.elasticfunnels.io/api/brands/{brand_id}/analytics/metrics/data?start=2024-12-01T00:00:00Z&end=2024-12-10T23:59:59Z&selected_metrics[]=metric_0" \
  -H "EF-Access-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "metric": {
      "0": {
        "name": "Profit Margin",
        "formula": "($revenue - $cogs - $ad_spend) / $revenue * 100",
        "as": "pct"
      }
    }
  }'
Custom metric formulas support:
  • Basic math operators: +, -, *, /, ()
  • Variables: $metric_name (e.g., $revenue, $sales)
  • Format types: currency, pct (percentage), time, number

Common Metrics

MetricDescriptionModule Required
revenueTotal revenueconversions
salesNumber of ordersconversions
aovAverage order valueconversions
conversion_rateConversion percentageconversions, tracking
page_viewsTotal page viewstracking
sessionsUnique sessionstracking
engagement_rateUser engagementtracking
time_on_pageAvg time on pagetracking
ad_spendAdvertising costintegrations
roasReturn on ad spendconversions, integrations
cogsCost of goods soldconversions
net_revenueRevenue minus costsconversions

Notes

  • All dates should be in ISO 8601 format
  • The system automatically compares current period with previous period of equal length
  • Some metrics require specific modules to be enabled
  • Permission-restricted metrics (like aff_id) require appropriate user permissions
  • Both Elasticsearch and ClickHouse backends are supported (auto-selected based on brand configuration)
When grouping by aff_id, ensure your API key’s user has the affiliates.view permission