mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Updated hooks. Changed url, host to path, hostname.
This commit is contained in:
parent
25a9c011b3
commit
543674c7f2
146 changed files with 23348 additions and 2533 deletions
|
|
@ -1,7 +1,15 @@
|
|||
import prisma from '@/lib/prisma';
|
||||
import clickhouse from '@/lib/clickhouse';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from '@/lib/db';
|
||||
import { QueryFilters, WebsiteEventData } from '@/lib/types';
|
||||
import { QueryFilters } from '@/lib/types';
|
||||
|
||||
export interface WebsiteEventData {
|
||||
eventName?: string;
|
||||
propertyName: string;
|
||||
dataType: number;
|
||||
propertyValue?: string;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export async function getEventDataEvents(
|
||||
...args: [websiteId: string, filters: QueryFilters]
|
||||
|
|
|
|||
|
|
@ -2,11 +2,17 @@ import clickhouse from '@/lib/clickhouse';
|
|||
import { EVENT_TYPE } from '@/lib/constants';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from '@/lib/db';
|
||||
import prisma from '@/lib/prisma';
|
||||
import { QueryFilters, WebsiteEventMetric } from '@/lib/types';
|
||||
import { QueryFilters } from '@/lib/types';
|
||||
|
||||
export interface WebsiteEventMetricData {
|
||||
x: string;
|
||||
t: string;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export async function getEventMetrics(
|
||||
...args: [websiteId: string, filters: QueryFilters]
|
||||
): Promise<WebsiteEventMetric[]> {
|
||||
): Promise<WebsiteEventMetricData[]> {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ async function relationalQuery(
|
|||
...filters,
|
||||
eventType: column === 'event_name' ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
|
||||
},
|
||||
{ joinSession: SESSION_COLUMNS.includes(type) || column === 'referrer_domain' },
|
||||
{
|
||||
joinSession: SESSION_COLUMNS.includes(type) || column === 'referrer_domain',
|
||||
},
|
||||
);
|
||||
|
||||
let entryExitQuery = '';
|
||||
|
|
@ -164,7 +166,7 @@ async function clickhouseQuery(
|
|||
${column === 'referrer_domain' ? 'uniq(s)' : 'count(*)'} as y
|
||||
from (
|
||||
select ${columnQuery} as t
|
||||
from website_event_stats_hourly website_event
|
||||
from website_event_stats_hourly as website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue