Analyze
Custom dashboards and SQL in Loogika
The built-in reports answer the common questions. For the rest, Loogika has a Query page where you run SQL against your events, and Dashboards where you save the results as charts.
Last updated .
How do you run a query?
Open Query in the site sidebar. Write SQL, or describe what you want in the box labelled "What do you want to query?" and click Generate.
Click Run to get the result as a table. Download results exports it as CSV or JSON. The Query page draws no charts, so use a dashboard for those.
Generate works on the query that is already there, so you can refine it with a follow-up.
Which data can you query?
Queries are read-only and use ClickHouse SQL. There is one table, scoped_events, which holds every event for the current site.
SELECT pathname, count() AS views
FROM scoped_events
WHERE type = 'pageview'
AND timestamp >= now() - INTERVAL 7 DAY
GROUP BY pathname
ORDER BY views DESC
LIMIT 20
Statements that write data, change settings or read other tables are rejected.
The most used columns:
| Column | Content |
|---|---|
timestamp | When the event arrived, in UTC |
type | pageview, custom_event, performance, outbound, error, button_click, copy, form_submit or input_change |
event_name | The name of a custom event or an error |
props | The event properties, as JSON |
session_id, user_id | The anonymous session and visitor |
identified_user_id | Your own user ID. Empty when the visitor is not identified |
hostname, pathname, querystring, page_title | The page |
url_parameters | The query parameters as a map, such as UTM values |
referrer, channel | Where the visit came from |
country, region, city, lat, lon, timezone | Location, found from the IP address |
browser, browser_version, operating_system, operating_system_version | Browser and system |
device_type, screen_width, screen_height, language | Device |
lcp, cls, inp, fcp, ttfb | Web Vitals, on performance events only |
tag | The value of data-tag |
ip | The IP address. Filled only when Track IP Address is on |
import_id | Set on imported events. Empty on tracked events |
asn, asn_org, is_datacenter_asn | The visitor's network |
site_id | The numeric site ID |
What are the limits?
| Limit | Value |
|---|---|
| Rows in a result | 1,000 |
| Run time | 10 seconds |
| Queries | 60 per minute |
| Generated queries | 20 per minute |
| Cards on a dashboard | 20 |
The Query page does not follow the date selector. Add your own condition on timestamp, or the query reads all your data.
How do you build a dashboard?
Open Dashboards in the site sidebar and create one. Add a card from the examples or start with an empty card.
A card has a title, a query and a chart type. You choose which columns to plot and how to format the values: number, percent, duration or bytes.
| Chart types |
|---|
| Line, Area, Bar, Bar list, Donut, Stat, Table, Map, Calendar |
Drag cards to move them and pull the corner to resize. Save with Ctrl+S, or ⌘S on a Mac.
How do cards follow the date selector?
On a dashboard, scoped_events only holds events from the period in the date selector. You do not filter on dates yourself.
Two placeholders keep the charts in step with the controls:
| Placeholder | Replaced with |
|---|---|
{ | The interval from the bucket selector, such as hour, day or week |
{ | Your time zone, so a daily bucket matches a calendar day |
Who can use queries and dashboards?
Every member who can open the site can run queries and open dashboards. Any of them can also create, edit and delete dashboards on that site.
Query and Dashboards are hidden on public dashboards and private links.