fastmon Docs
Analytics

Run an analytics query

Report an issue

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, ttfb, fcp and page_load_time 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: compare_to takes a mode (previous_period, previous_day, previous_week, previous_month), a {from, to} window of any length, or a {release_id} whose window starts at that release. The resolved window is echoed as request.comparison_time_range. compare_to_release_id is deprecated.

Limits:

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

Authorization

bearerAuth
headerAuthorizationBearer <fm_… / fmo_…>

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.

Path Parameters

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']). first_party_error_rate and third_party_error_rate split error_rate, the share of pageviews with any JavaScript error, by error_origin. AVG-only ratios 0-1. Grouped by errors.fingerprint alone, error_beacons is the weighted pageviews carrying each signature and error_rate their share of every pageview of the bucket or window. performed_dns_lookup and new_tcp_connection are dns_lookup and tcp_connection over the pageviews that did a lookup or opened a connection, the rated durations. skipped_dns_lookup_rate and reused_tcp_connection_rate are the AVG-only share 0-1 of the pageviews reporting the timing that did not. 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 rating of GET /metric-thresholds, 0..1 and unweighted. They take only lcp, inp, cls, ttfb, fcp, performed_dns_lookup and new_tcp_connection. For the last two the denominator is the page views that did a lookup or opened a connection.

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

Grouping configuration (time and/or dimensions)

timezone?|

IANA time zone whose boundaries start the six_hours, day, week and month buckets, such as Europe/Berlin. A day is 23 or 25 hours long across a DST switch. Bucket timestamps stay UTC. In a zone whose offset is not whole hours a bucket starts at the UTC hour that holds the local boundary. Without it the buckets start at UTC boundaries

filters?

Optional filters

compare_to?|||

The window to compare with, in one of three forms. A mode: previous_period is 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. A window {from, to} of any length. A release {release_id}: from its released_at, as long as time_range, cut at the next release of its application and at now. Time buckets pair by their offset from the start of each window.

compare_to_release_id?|Deprecated

Compare before against after a release inside the window. Deprecated: send the two sides as time_range and a compare_to window.

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.

url_param_key?|

The query key whose value the url_param dimension groups by, required with it and refused without it. The key has to keep its value in every application of the scope: listed in collection.query_values_for, or, in an application that does not keep query keys, a search term key a page type keeps (q, search, searchparam) or the platform's controller key (cl on OXID). Any other key answers 422

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
Example Request
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"  ]}'
Example Response
{  "data": [    {      "timestamp": "2019-08-24T14:15:22Z",      "values_by_dimension": {        "property1": "string",        "property2": "string"      },      "metrics": [        {          "metric": "string",          "aggregation": "count",          "value": 0        }      ],      "sample_count": 0,      "comparison": {        "metrics": [          {            "metric": "string",            "aggregation": "count",            "value": 0          }        ],        "sample_count": 0,        "relative_change": 0,        "beacons": 0      },      "beacons": 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,    "complete_until": "2019-08-24T14:15:22Z",    "query_hash": "string",    "granularity_options": [      "minute"    ],    "pageviews": 0  },  "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": {},    "url_param_key": "string"  }}