fastmon Docs
Analytics

Run an analytics query

Fehler melden

Execute a flexible analytics query against RUM data.

Metrics: lcp, fcp, cls, inp, ttfb, tbt, page_load_time, requests, visitors (distinct visitors; identity=stitch|session picks the backing identifier, stitch preferred), etc.

Aggregations: count, avg, p50, p75, p90, p95, p99, min, max, sum, and for lcp, inp, cls and ttfb good_share, needs_improvement_share and poor_share: the part of the page views that reported the metric in that web vitals rating, 0..1.

Grouping: By time intervals (hour, day, week, month) and/or dimensions (browser, device_type, country, etc.)

Filters: site_id, browser, device_type, country, url (with wildcards), etc.

Comparison: Set compare_to to compare with previous_period, previous_day, previous_week, or previous_month. previous_period is the same window the smallest whole number of weeks earlier that covers it, at least one. previous_day is the same window 24 hours earlier.

Limits:

  • Max 90 days time range
  • Max 20 metrics per query
  • Max 2 GROUP BY dimensions
  • Max 10,000 rows per response

Authentifizierung

bearerAuth
headerAuthentifizierungBearer <token>

API token generated from the fastmon dashboard (Account → API Token) or at organization level (fmo_…, one that outlives its creator). Send as Authorization: Bearer fm_... or paste the full token (including its prefix) into the Authorize dialog.

Pfad-Parameter

org_id*Org Id
Formatuuid

Request-Body

application/json
  1. body

Main request schema for analytics queries.

time_range*

Time range for the query (required)

metrics*array<string|>

Metrics to query. Strings for flat or Nested (errors.count) metrics; objects for Map-key access (e.g. resource_sizes['script']). cdn_served_rate/origin_served_rate are the share answered from the layer's stored copy, the sum of its hit, stale, updating and revalidated status rates below. Cache-status rates follow the pattern (cdn|origin)_status_rate_<status> (lowercase, e.g. cdn_status_rate_miss; unreported = no status sent) - AVG-only ratio 0-1 over all pageviews. cdn_hit_rate/origin_hit_rate are legacy aliases for *_status_rate_hit. The ttfb_phase_* ids split coalesce(ttfb_final, ttfb) per pageview, and the avg of ttfb_phase_connect, _edge, _origin, _backend, _unattributed and _unmeasured sum to its average over the pageviews they cover, those whose first byte is at least the DNS lookup plus the TCP connection.

Items1 <= items <= 20
aggregations?array<>

Aggregation functions to apply. good_share, needs_improvement_share and poor_share are the part of the bucket's page views that reported the metric and fall in that web vitals rating, 0..1 and unweighted. They take only lcp, inp, cls and ttfb.

Items1 <= items <= 7
Default
[  "p75"]
group_by?

Grouping configuration (time and/or dimensions)

filters?

Optional filters

compare_to?|

Compare with an earlier window of the same length. previous_period: the smallest whole number of weeks earlier that covers the window, at least one. previous_day: 24 hours earlier. previous_week: 7 days earlier. previous_month: 30 days earlier.

compare_to_release_id?|

Compare metrics before vs after a specific release

limit?Limit

Maximum rows to return

Range1 <= value <= 10000
Default2500
offset?Offset

Offset for pagination

Range0 <= value
Default0
order_by?|

Sort configuration

identity?|

Backing identifier for the visitors metric: 'stitch' (preferred - edge-derived, present under ANONYMOUS) or 'session' (consent-gated session_id). Null resolves to the application's default (stitch unless the application only collects sessions). Ignored by all other metrics.

Response-Body

Successful Response

application/json
  1. response

Response for analytics queries.

data*array<>

Query result data points

meta*

Query metadata

request*

The request as the server resolved it

POST
/organizations/{org_id}/analytics/query
curl -X POST 'https://api.fastmon.eu/organizations/497f6eca-6276-4993-bfeb-53cbbbba6f08/analytics/query' \  -H 'Content-Type: application/json' \  -d '{  "time_range": {    "from": "2019-08-24T14:15:22Z",    "to": "2019-08-24T14:15:22Z"  },  "metrics": [    "string"  ]}'
{  "data": [    {      "timestamp": "2019-08-24T14:15:22Z",      "values_by_dimension": {        "property1": "string",        "property2": "string"      },      "metrics": [        {          "metric": "string",          "aggregation": "count",          "value": 0        }      ],      "beacons": 0,      "comparison": {        "metrics": [          {            "metric": "string",            "aggregation": "count",            "value": 0          }        ],        "beacons": 0,        "relative_change": 0      }    }  ],  "meta": {    "execution_time_ms": 0,    "total": 0,    "limit": 0,    "offset": 0,    "has_more": true,    "next_cursor": "string",    "sampling": {      "sampling_rate": 0,      "is_sampled": true,      "estimated_metrics": [        "string"      ]    },    "is_identity_mixed": true,    "query_hash": "string"  },  "request": {    "time_range": {      "from": "2019-08-24T14:15:22Z",      "to": "2019-08-24T14:15:22Z"    },    "comparison_time_range": {      "from": "2019-08-24T14:15:22Z",      "to": "2019-08-24T14:15:22Z"    },    "granularity": "minute",    "identity": "stitch",    "window_seconds": 0,    "filters": {}  }}