mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c90bd941b5
@ -120,11 +120,15 @@ function getFilterQuery(filters = {}, params = []) {
|
||||
case 'browser':
|
||||
case 'device':
|
||||
case 'country':
|
||||
case 'eventName':
|
||||
arr.push(`and ${key}=$${params.length + 1}`);
|
||||
params.push(decodeURIComponent(filter));
|
||||
break;
|
||||
|
||||
case 'eventName':
|
||||
arr.push(`and event_name=$${params.length + 1}`);
|
||||
params.push(decodeURIComponent(filter));
|
||||
break;
|
||||
|
||||
case 'referrer':
|
||||
arr.push(`and referrer like $${params.length + 1}`);
|
||||
params.push(`%${decodeURIComponent(filter)}%`);
|
||||
@ -147,12 +151,12 @@ function getFilterQuery(filters = {}, params = []) {
|
||||
}
|
||||
|
||||
function parseFilters(filters = {}, params = []) {
|
||||
const { domain, url, event_url, referrer, os, browser, device, country, eventName, query } =
|
||||
const { domain, url, eventUrl, referrer, os, browser, device, country, eventName, query } =
|
||||
filters;
|
||||
|
||||
const pageviewFilters = { domain, url, referrer, query };
|
||||
const sessionFilters = { os, browser, device, country };
|
||||
const eventFilters = { url: event_url, eventName };
|
||||
const eventFilters = { url: eventUrl, eventName };
|
||||
|
||||
return {
|
||||
pageviewFilters,
|
||||
|
@ -124,19 +124,26 @@ function getFilterQuery(filters = {}, params = []): string {
|
||||
case 'browser':
|
||||
case 'device':
|
||||
case 'country':
|
||||
case 'eventName':
|
||||
arr.push(`and ${key}=$${params.length + 1}`);
|
||||
params.push(decodeURIComponent(filter));
|
||||
break;
|
||||
|
||||
case 'eventName':
|
||||
arr.push(`and event_name=$${params.length + 1}`);
|
||||
params.push(decodeURIComponent(filter));
|
||||
break;
|
||||
|
||||
case 'referrer':
|
||||
arr.push(`and referrer like $${params.length + 1}`);
|
||||
params.push(`%${decodeURIComponent(filter)}%`);
|
||||
break;
|
||||
|
||||
case 'domain':
|
||||
arr.push(`and referrer not like $${params.length + 1}`);
|
||||
arr.push(`and referrer not like '/%'`);
|
||||
params.push(`%://${filter}/%`);
|
||||
break;
|
||||
|
||||
case 'query':
|
||||
arr.push(`and url like '%?%'`);
|
||||
}
|
||||
@ -152,12 +159,12 @@ function parseFilters(
|
||||
params = [],
|
||||
sessionKey = 'session_id',
|
||||
) {
|
||||
const { domain, url, event_url, referrer, os, browser, device, country, eventName, query } =
|
||||
const { domain, url, eventUrl, referrer, os, browser, device, country, eventName, query } =
|
||||
filters;
|
||||
|
||||
const pageviewFilters = { domain, url, referrer, query };
|
||||
const sessionFilters = { os, browser, device, country };
|
||||
const eventFilters = { url: event_url, eventName };
|
||||
const eventFilters = { url: eventUrl, eventName };
|
||||
|
||||
return {
|
||||
pageviewFilters,
|
||||
|
@ -31,7 +31,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
|
||||
const { type, payload } = getJsonBody(req);
|
||||
|
||||
const { referrer, eventName, event_data: eventData } = payload;
|
||||
const { referrer, eventName, eventData } = payload;
|
||||
let { url } = payload;
|
||||
|
||||
// Validate eventData is JSON
|
||||
|
@ -34,7 +34,7 @@ export default async (
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { startAt, endAt, event_name: eventName, columns, filters } = req.body;
|
||||
const { startAt, endAt, eventName, columns, filters } = req.body;
|
||||
|
||||
const startDate = new Date(+startAt);
|
||||
const endDate = new Date(+endAt);
|
||||
|
@ -134,7 +134,7 @@ export default async (
|
||||
browser: type !== 'browser' ? browser : undefined,
|
||||
device: type !== 'device' ? device : undefined,
|
||||
country: type !== 'country' ? country : undefined,
|
||||
event_url: type !== 'url' && table === 'event' ? url : undefined,
|
||||
eventUrl: type !== 'url' && table === 'event' ? url : undefined,
|
||||
query: type === 'query' && table !== 'event' ? true : undefined,
|
||||
};
|
||||
|
||||
|
@ -108,8 +108,8 @@
|
||||
assign(getPayload(), {
|
||||
website: websiteId,
|
||||
url,
|
||||
event_name: eventName,
|
||||
event_data: eventData,
|
||||
eventName: eventName,
|
||||
eventData: eventData,
|
||||
}),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user