-
Notifications
You must be signed in to change notification settings - Fork 0
/
top_browsers.pipe
31 lines (28 loc) · 1005 Bytes
/
top_browsers.pipe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
DESCRIPTION >
Top Browsers ordered by most visits.
Accepts `date_from` and `date_to` date filter. Defaults to last 7 days.
Also `skip` and `limit` parameters for pagination.
TOKEN "dashboard" READ
NODE endpoint
DESCRIPTION >
Group by browser and calculate hits and visits
SQL >
%
select browser, uniqMerge(visits) as visits, countMerge(hits) as hits
from analytics_sources_mv
where
{% if defined(date_from) %}
date
>=
{{ Date(date_from, description="Starting day for filtering a date range", required=False) }}
{% else %} date >= timestampAdd(today(), interval -7 day)
{% end %}
{% if defined(date_to) %}
and date
<=
{{ Date(date_to, description="Finishing day for filtering a date range", required=False) }}
{% else %} and date <= today()
{% end %}
group by browser
order by visits desc
limit {{ Int32(skip, 0) }},{{ Int32(limit, 50) }}