mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
fix: forgot to include referrer filter in sessionMetrics
This commit is contained in:
parent
7c744589ae
commit
0377773e21
@ -424,15 +424,21 @@ export function getPageviewStats(
|
||||
|
||||
export function getSessionMetrics(website_id, start_at, end_at, field, filters = {}) {
|
||||
const params = [website_id, start_at, end_at];
|
||||
const { url } = filters;
|
||||
const { url, referrer } = filters;
|
||||
|
||||
let urlFilter = '';
|
||||
let refFilter = '';
|
||||
|
||||
if (url) {
|
||||
urlFilter = `and url=$${params.length + 1}`;
|
||||
params.push(decodeURIComponent(url));
|
||||
}
|
||||
|
||||
if (referrer) {
|
||||
refFilter = `and referrer like $${params.length + 1}`;
|
||||
params.push(`%${decodeURIComponent(referrer)}%`);
|
||||
}
|
||||
|
||||
return rawQuery(
|
||||
`
|
||||
select ${field} x, count(*) y
|
||||
@ -443,6 +449,7 @@ export function getSessionMetrics(website_id, start_at, end_at, field, filters =
|
||||
where website_id=$1
|
||||
and created_at between $2 and $3
|
||||
${urlFilter}
|
||||
${refFilter}
|
||||
)
|
||||
group by 1
|
||||
order by 2 desc
|
||||
|
@ -40,7 +40,7 @@ export default async (req, res) => {
|
||||
const endDate = new Date(+end_at);
|
||||
|
||||
if (sessionColumns.includes(type)) {
|
||||
let data = await getSessionMetrics(websiteId, startDate, endDate, type, { url });
|
||||
let data = await getSessionMetrics(websiteId, startDate, endDate, type, { url, referrer });
|
||||
|
||||
if (type === 'language') {
|
||||
let combined = {};
|
||||
|
Loading…
Reference in New Issue
Block a user