Update queries to calculate correct metrics.
This commit is contained in:
1 parent
1dfa6d8b16
commit
a24bee815c
2 files changed
+43
-21
No files matched your search
+23
-3
@@ -333,12 +333,32 @@ export function getPageviews(
|
||||
);
|
||||
}
|
||||
|
||||
export function getRankings(website_id, start_at, end_at, type, table, domain) {
|
||||
const filter = domain ? `and ${type} not like '%${domain}%'` : '';
|
||||
export function getSessionMetrics(website_id, start_at, end_at, field) {
|
||||
return rawQuery(
|
||||
`
|
||||
select ${field} x, count(*) y
|
||||
from session
|
||||
where session_id in (
|
||||
select session_id
|
||||
from pageview
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
)
|
||||
group by 1
|
||||
order by 2 desc
|
||||
`,
|
||||
website_id,
|
||||
start_at,
|
||||
end_at,
|
||||
);
|
||||
}
|
||||
|
||||
export function getPageviewMetrics(website_id, start_at, end_at, field, table, domain) {
|
||||
const filter = domain ? `and ${field} not like '%${domain}%'` : '';
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select distinct ${type} x, count(*) y
|
||||
select ${field} x, count(*) y
|
||||
from ${table}
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
|
||||
Reference in new issue
Block a user