Dashtics
Home DQL Reference

DQL Reference

Dashtics Query Language — a structured, safe query language for your site analytics. Looks like SQL, runs only on your own data.

Dashtics Query Language

DQL is a structured, safe query language for your site analytics. It looks like SQL but only operates on your own data — no injections, no table scans, no cross-site leaks. Every identifier is validated server-side against a fixed allowlist before execution.

Full syntax

SHOW metric [AS alias] [, metric, ...] FROM analytics -- always your site's events SINCE -30d | DURING last_month -- or any named period WHERE field = "value" [AND|OR field != "value"] TIMESERIES week -- time-series GROUP BY GROUP BY dimension[, dimension] HAVING metric > 0 -- filter on aggregated results ORDER BY field [ASC|DESC] LIMIT 100 [OFFSET 0] -- max 2 000 (server enforced)

Quick start

Create a free account to access the DQL editor in the Reports page. Press Ctrl+Enter (or ⌘+Enter) to run a query.

SHOW sessions, visitors, bounce_rate FROM analytics SINCE -30d GROUP BY channel ORDER BY sessions DESC

SHOW

Selects which metrics to calculate. Required. Comma-separate multiple metrics. Use AS alias to rename a column in results and reference it in HAVING or ORDER BY.

SHOW sessions SHOW pageviews, visitors, bounce_rate SHOW sessions AS visits, bounce_rate AS br

FROM

Always analytics. Optional clause — the schema is fixed to your site's data.

SHOW pageviews FROM analytics SINCE -7d

SINCE / UNTIL

Rolling window shorthand or exact custom range. Use DURING for named calendar periods (see below).

FormMeaningExample
todayCurrent day so farSINCE today
-7dLast 7 daysSINCE -7d
-30dLast 30 days (default)SINCE -30d
-90dLast 90 daysSINCE -90d
"YYYY-MM-DD"Custom range with UNTILSINCE "2025-01-01" UNTIL "2025-03-31"
SINCE -90d SINCE "2025-01-01" UNTIL "2025-03-31"

DURING

Named calendar ranges — easier to read than rolling windows and snapped to clean boundaries (e.g. the full month, not "30 days ago").

PeriodMeaning
todayCurrent day (midnight to now)
yesterdayPrevious full day
this_week / last_weekISO week (Monday–Sunday)
this_month / last_monthCalendar month
this_quarter / last_quarterCalendar quarter (Q1–Q4)
this_year / last_yearFull calendar year
SHOW sessions, revenue FROM analytics DURING last_month GROUP BY channel

WHERE

Filters rows before aggregation. Chain multiple conditions with AND or OR. Standard SQL precedence: AND binds tighter than OR.

WHERE channel = "organic" WHERE device = "mobile" AND country = "NL" WHERE channel IN ("organic", "referral") OR device != "mobile" WHERE page STARTS WITH "/blog" WHERE country NOT IN ("NL", "BE") WHERE referrer IS NOT NULL

TIMESERIES

Shorthand for time-based GROUP BY. Makes intent clearer and auto-sorts the time axis ascending so charts read left-to-right. Accepts the same time dimensions as GROUP BY.

SHOW sessions, visitors FROM analytics DURING this_quarter TIMESERIES week -- equivalent to: GROUP BY week ORDER BY week ASC

GROUP BY

Breaks results down by one or more dimensions. Without it, a single summary row is returned.

GROUP BY channel GROUP BY date -- daily trend, sorted ASC automatically GROUP BY week -- weekly, sorted ASC automatically GROUP BY month -- monthly, sorted ASC automatically GROUP BY country, device -- two-level breakdown

HAVING

Filters after aggregation — useful to exclude noise (e.g. pages with fewer than 10 sessions). Uses the metric name or alias from SHOW. Supports >, <, >=, <=, =, != and AND / OR.

SHOW sessions AS visits, bounce_rate FROM analytics DURING last_month GROUP BY page HAVING visits > 50 AND bounce_rate < 70 ORDER BY visits DESC

ORDER BY

Explicit sort — when specified, overrides auto-derived ordering. Reference a metric name, its alias (from AS), or a dimension. Auto-sort: time dims → ASC, other dims → first metric DESC.

ORDER BY sessions DESC ORDER BY date ASC ORDER BY visits DESC -- "visits" = alias defined with AS

Operators

OperatorMeaningExample
=Exact matchchannel = "organic"
!=Does not matchdevice != "tablet"
CONTAINSSubstring match (case-insensitive)page CONTAINS "/blog"
NOT CONTAINSDoes not contain substringpage NOT CONTAINS "?utm"
STARTS WITHPrefix match (case-insensitive)page STARTS WITH "/blog"
ENDS WITHSuffix match (case-insensitive)page ENDS WITH ".html"
IN (...)Matches any value in the listchannel IN ("organic", "referral")
NOT IN (...)Matches none of the valuescountry NOT IN ("NL", "BE")
BETWEEN … AND …Inclusive rangepage BETWEEN "/a" AND "/z"
NOT BETWEEN … AND …Outside rangepage NOT BETWEEN "/a" AND "/z"
IS NULLValue is absent / emptyreferrer IS NULL
IS NOT NULLValue is presentutm_campaign IS NOT NULL
> < >= <=Numeric comparison — HAVING onlyHAVING sessions > 100
ANDBoth conditions must be true (binds tighter than OR)device = "mobile" AND country = "NL"
OREither condition must be truechannel = "organic" OR channel = "direct"

Metric reference

MetricDescriptionUnit
sessionsUnique browser sessionscount
pageviewsTotal page loadscount
visitorsUnique visitorscount
bounce_ratePercentage of single-page sessions%
avg_durationAverage time on page (per page load)seconds
pages_per_sessionAverage pages viewed per sessiondecimal
avg_session_durationAverage total time in sessionseconds
revenueTotal order revenue (ecommerce)
ordersNumber of completed orders (ecommerce)count
avg_order_valueRevenue ÷ orders (ecommerce)
conversion_rateOrders ÷ sessions × 100 (ecommerce)%

Dimension reference

DimensionIn WHERE?DescriptionExample values
channelTraffic channelorganic, direct, paid, referral, social
countryVisitor country (ISO code)NL, US, DE
pagePage URL path/blog/post-1
deviceDevice typedesktop, mobile, tablet
browserBrowser nameChrome, Firefox, Safari
osOperating systemWindows, macOS, iOS, Android
cityVisitor cityAmsterdam, Berlin, London
languageBrowser languagenl, en, en-US, de
referrerHTTP referrer URLgoogle.com, t.co
utm_sourceUTM source paramgoogle, newsletter
utm_mediumUTM medium paramcpc, email
utm_campaignUTM campaign paramspring-sale
datePer-day breakdown (sorts ASC)2025-08-01
weekISO week start date (sorts ASC)2025-07-28
monthMonth start date (sorts ASC)2025-08-01
hourHour of day 0–23 UTC (sorts ASC)0, 9, 14, 23
weekdayDay of week 1=Mon … 7=Sun (sorts ASC)1, 5, 7

Examples

Top channels by sessions (last 30 days)

SHOW sessions, visitors, bounce_rate FROM analytics SINCE -30d GROUP BY channel ORDER BY sessions DESC

Daily pageview trend (last 7 days)

SHOW pageviews, visitors FROM analytics SINCE -7d GROUP BY date ORDER BY date ASC

Last month — high-traffic pages only (HAVING + alias)

SHOW sessions AS hits, bounce_rate, avg_session_duration FROM analytics DURING last_month GROUP BY page HAVING hits > 100 AND bounce_rate < 60 ORDER BY hits DESC LIMIT 20

Paid + social channels — multi-channel filter

SHOW sessions, visitors, conversion_rate FROM analytics DURING this_quarter WHERE channel IN ("paid", "social", "referral") GROUP BY channel ORDER BY sessions DESC

Weekly traffic trend — organic only

SHOW sessions, visitors FROM analytics SINCE -90d WHERE channel = "organic" TIMESERIES week

Try DQL on your own data

The DQL editor is built into the Reports page. Sign up free — no credit card needed.

Create free account →