Skip to content

AnalyticsQueryRequest ​

Example Usage ​

typescript
import { AnalyticsQueryRequest } from "@meetkai/mka1/models/components";

let value: AnalyticsQueryRequest = {
  metric: "unique_visitors",
  from: new Date("2026-09-01T00:00:00Z"),
  to: new Date("2026-09-02T00:00:00Z"),
  eventName: "page_view",
  bucket: "hour",
  timezone: "America/Los_Angeles",
  groupBy: "pathname",
  filters: [
    {
      property: "plan",
      op: "eq",
      value: "pro",
    },
  ],
};

Fields ​

FieldTypeRequiredDescriptionExample
metriccomponents.AnalyticsQueryRequestMetric✔️count counts events. unique_visitors counts distinct values of distinct_id. Both deduplicate event IDs first.
fromDate✔️Start of the time range, inclusive. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Must be before to.2026-09-01T00:00:00Z
toDate✔️End of the time range, exclusive. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Must be after from.2026-09-02T00:00:00Z
eventNamestring➖Only include events with this exact name. Omit to include all event names.page_view
bucketcomponents.Bucket➖Split results into time buckets. Hours, days, and Monday-start weeks begin on the clock of timezone, which defaults to UTC. Empty buckets are omitted.
timezonestring➖IANA time zone name that sets where buckets start. Defaults to UTC. A day is a local calendar day and lasts 23 or 25 hours when the clocks change. In zones offset by 30 or 45 minutes, hours start on the local clock. UTC offsets such as +05:30 are rejected, as are identifiers outside the IANA database such as PST or BST, and names the service's time zone database does not know, which can lag the newest IANA zones; fall back to UTC when the 400 names timezone. Only bucket boundaries change: from, to, filters, and the UTC format of each row's bucket stay the same. Has no effect without bucket.Example 1: America/Los_Angeles
Example 2: Asia/Kolkata
Example 3: UTC
groupBystring➖Group results by one event property. Missing values and null share a group.pathname
filterscomponents.AnalyticsQueryRequestFilters[]➖Property filters combined with AND. An event must match every filter.
limitnumber➖Maximum number of result rows, including rows created by time buckets and property groups.