mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 14:05:35 +01:00
Compare commits
No commits in common. "ee698b636a32fddeea524cb0e6fdcf6742ff8b6d" and "1229663814c12fb02b3c5d7ac487ab04266a2d58" have entirely different histories.
ee698b636a
...
1229663814
23 changed files with 74 additions and 195 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import { Column, Grid, Row } from '@umami/react-zen';
|
import { Column, Grid, Row } from '@umami/react-zen';
|
||||||
import { BounceFilter } from '@/components/input/BounceFilter';
|
|
||||||
import { ExportButton } from '@/components/input/ExportButton';
|
import { ExportButton } from '@/components/input/ExportButton';
|
||||||
import { FilterBar } from '@/components/input/FilterBar';
|
import { FilterBar } from '@/components/input/FilterBar';
|
||||||
import { MonthFilter } from '@/components/input/MonthFilter';
|
import { MonthFilter } from '@/components/input/MonthFilter';
|
||||||
|
|
@ -9,7 +8,6 @@ import { WebsiteFilterButton } from '@/components/input/WebsiteFilterButton';
|
||||||
export function WebsiteControls({
|
export function WebsiteControls({
|
||||||
websiteId,
|
websiteId,
|
||||||
allowFilter = true,
|
allowFilter = true,
|
||||||
allowBounceFilter = false,
|
|
||||||
allowDateFilter = true,
|
allowDateFilter = true,
|
||||||
allowMonthFilter,
|
allowMonthFilter,
|
||||||
allowDownload = false,
|
allowDownload = false,
|
||||||
|
|
@ -17,7 +15,6 @@ export function WebsiteControls({
|
||||||
}: {
|
}: {
|
||||||
websiteId: string;
|
websiteId: string;
|
||||||
allowFilter?: boolean;
|
allowFilter?: boolean;
|
||||||
allowBounceFilter?: boolean;
|
|
||||||
allowDateFilter?: boolean;
|
allowDateFilter?: boolean;
|
||||||
allowMonthFilter?: boolean;
|
allowMonthFilter?: boolean;
|
||||||
allowDownload?: boolean;
|
allowDownload?: boolean;
|
||||||
|
|
@ -26,9 +23,8 @@ export function WebsiteControls({
|
||||||
return (
|
return (
|
||||||
<Column gap>
|
<Column gap>
|
||||||
<Grid columns={{ xs: '1fr', md: 'auto 1fr' }} gap>
|
<Grid columns={{ xs: '1fr', md: 'auto 1fr' }} gap>
|
||||||
<Row alignItems="center" justifyContent="flex-start" gap="4">
|
<Row alignItems="center" justifyContent="flex-start">
|
||||||
{allowFilter && <WebsiteFilterButton websiteId={websiteId} />}
|
{allowFilter ? <WebsiteFilterButton websiteId={websiteId} /> : <div />}
|
||||||
{allowBounceFilter && <BounceFilter />}
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row alignItems="center" justifyContent={{ xs: 'flex-start', md: 'flex-end' }}>
|
<Row alignItems="center" justifyContent={{ xs: 'flex-start', md: 'flex-end' }}>
|
||||||
{allowDateFilter && (
|
{allowDateFilter && (
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ export function WebsiteNav({
|
||||||
compare: undefined,
|
compare: undefined,
|
||||||
view: undefined,
|
view: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
excludeBounce: undefined,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { WebsitePanels } from './WebsitePanels';
|
||||||
export function WebsitePage({ websiteId }: { websiteId: string }) {
|
export function WebsitePage({ websiteId }: { websiteId: string }) {
|
||||||
return (
|
return (
|
||||||
<Column gap>
|
<Column gap>
|
||||||
<WebsiteControls websiteId={websiteId} allowBounceFilter={true} />
|
<WebsiteControls websiteId={websiteId} />
|
||||||
<WebsiteMetricsBar websiteId={websiteId} showChange={true} />
|
<WebsiteMetricsBar websiteId={websiteId} showChange={true} />
|
||||||
<Panel minHeight="520px">
|
<Panel minHeight="520px">
|
||||||
<Row justifyContent="end">
|
<Row justifyContent="end">
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ export async function POST(request: Request) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
entityId: z.uuid(),
|
entityId: z.uuid(),
|
||||||
shareType: z.coerce.number().int(),
|
shareType: z.coerce.number().int(),
|
||||||
name: z.string().max(200),
|
|
||||||
slug: z.string().max(100).optional(),
|
slug: z.string().max(100).optional(),
|
||||||
parameters: anyObjectParam,
|
parameters: anyObjectParam,
|
||||||
});
|
});
|
||||||
|
|
@ -22,8 +21,7 @@ export async function POST(request: Request) {
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { entityId, shareType, name, slug, parameters } = body;
|
const { entityId, shareType, slug, parameters } = body;
|
||||||
const shareParameters = parameters ?? {};
|
|
||||||
|
|
||||||
if (!(await canUpdateEntity(auth, entityId))) {
|
if (!(await canUpdateEntity(auth, entityId))) {
|
||||||
return unauthorized();
|
return unauthorized();
|
||||||
|
|
@ -33,9 +31,8 @@ export async function POST(request: Request) {
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
entityId,
|
entityId,
|
||||||
shareType,
|
shareType,
|
||||||
name,
|
|
||||||
slug: slug || getRandomChars(16),
|
slug: slug || getRandomChars(16),
|
||||||
parameters: shareParameters,
|
parameters,
|
||||||
});
|
});
|
||||||
|
|
||||||
return json(share);
|
return json(share);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export async function POST(request: Request) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: z.string().max(100),
|
name: z.string().max(100),
|
||||||
domain: z.string().max(500),
|
domain: z.string().max(500),
|
||||||
|
shareId: z.string().max(50).nullable().optional(),
|
||||||
teamId: z.uuid().nullable().optional(),
|
teamId: z.uuid().nullable().optional(),
|
||||||
id: z.uuid().nullable().optional(),
|
id: z.uuid().nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|
@ -48,7 +49,7 @@ export async function POST(request: Request) {
|
||||||
return error();
|
return error();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id, name, domain, teamId } = body;
|
const { id, name, domain, shareId, teamId } = body;
|
||||||
|
|
||||||
if (process.env.CLOUD_MODE && !teamId) {
|
if (process.env.CLOUD_MODE && !teamId) {
|
||||||
const account = await fetchAccount(auth.user.id);
|
const account = await fetchAccount(auth.user.id);
|
||||||
|
|
@ -71,6 +72,7 @@ export async function POST(request: Request) {
|
||||||
createdBy: auth.user.id,
|
createdBy: auth.user.id,
|
||||||
name,
|
name,
|
||||||
domain,
|
domain,
|
||||||
|
shareId,
|
||||||
teamId,
|
teamId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ export function useFilterParameters() {
|
||||||
search,
|
search,
|
||||||
segment,
|
segment,
|
||||||
cohort,
|
cohort,
|
||||||
excludeBounce,
|
|
||||||
},
|
},
|
||||||
} = useNavigation();
|
} = useNavigation();
|
||||||
|
|
||||||
|
|
@ -48,7 +47,6 @@ export function useFilterParameters() {
|
||||||
search,
|
search,
|
||||||
segment,
|
segment,
|
||||||
cohort,
|
cohort,
|
||||||
excludeBounce,
|
|
||||||
};
|
};
|
||||||
}, [
|
}, [
|
||||||
path,
|
path,
|
||||||
|
|
@ -71,6 +69,5 @@ export function useFilterParameters() {
|
||||||
search,
|
search,
|
||||||
segment,
|
segment,
|
||||||
cohort,
|
cohort,
|
||||||
excludeBounce,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
'use client';
|
|
||||||
import { Checkbox, Row } from '@umami/react-zen';
|
|
||||||
import { useMessages } from '@/components/hooks/useMessages';
|
|
||||||
import { useNavigation } from '@/components/hooks/useNavigation';
|
|
||||||
|
|
||||||
export function BounceFilter() {
|
|
||||||
const { router, query, updateParams } = useNavigation();
|
|
||||||
const { formatMessage, labels } = useMessages();
|
|
||||||
const isSelected = query.excludeBounce === 'true';
|
|
||||||
|
|
||||||
const handleChange = (value: boolean) => {
|
|
||||||
if (value) {
|
|
||||||
router.push(updateParams({ excludeBounce: 'true' }));
|
|
||||||
} else {
|
|
||||||
router.push(updateParams({ excludeBounce: undefined }));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Row alignItems="center" gap>
|
|
||||||
<Checkbox isSelected={isSelected} onChange={handleChange}>
|
|
||||||
{formatMessage(labels.excludeBounce)}
|
|
||||||
</Checkbox>
|
|
||||||
</Row>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -111,7 +111,6 @@ export const labels = defineMessages({
|
||||||
event: { id: 'label.event', defaultMessage: 'Event' },
|
event: { id: 'label.event', defaultMessage: 'Event' },
|
||||||
events: { id: 'label.events', defaultMessage: 'Events' },
|
events: { id: 'label.events', defaultMessage: 'Events' },
|
||||||
eventName: { id: 'label.event-name', defaultMessage: 'Event name' },
|
eventName: { id: 'label.event-name', defaultMessage: 'Event name' },
|
||||||
excludeBounce: { id: 'label.exclude-bounce', defaultMessage: 'Exclude bounces' },
|
|
||||||
query: { id: 'label.query', defaultMessage: 'Query' },
|
query: { id: 'label.query', defaultMessage: 'Query' },
|
||||||
queryParameters: { id: 'label.query-parameters', defaultMessage: 'Query parameters' },
|
queryParameters: { id: 'label.query-parameters', defaultMessage: 'Query parameters' },
|
||||||
back: { id: 'label.back', defaultMessage: 'Back' },
|
back: { id: 'label.back', defaultMessage: 'Back' },
|
||||||
|
|
|
||||||
|
|
@ -131,25 +131,6 @@ function getCohortQuery(filters: Record<string, any>) {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExcludeBounceQuery(filters: Record<string, any>) {
|
|
||||||
if (!filters.excludeBounce === true) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return `join
|
|
||||||
(select distinct session_id, visit_id
|
|
||||||
from website_event
|
|
||||||
where website_id = {websiteId:UUID}
|
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
|
||||||
and event_type = 1
|
|
||||||
group by session_id, visit_id
|
|
||||||
having count(*) > 1
|
|
||||||
) excludeBounce
|
|
||||||
on excludeBounce.session_id = website_event.session_id
|
|
||||||
and excludeBounce.visit_id = website_event.visit_id
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDateQuery(filters: Record<string, any>) {
|
function getDateQuery(filters: Record<string, any>) {
|
||||||
const { startDate, endDate, timezone } = filters;
|
const { startDate, endDate, timezone } = filters;
|
||||||
|
|
||||||
|
|
@ -193,7 +174,6 @@ function parseFilters(filters: Record<string, any>, options?: QueryOptions) {
|
||||||
dateQuery: getDateQuery(filters),
|
dateQuery: getDateQuery(filters),
|
||||||
queryParams: getQueryParams(filters),
|
queryParams: getQueryParams(filters),
|
||||||
cohortQuery: getCohortQuery(cohortFilters),
|
cohortQuery: getCohortQuery(cohortFilters),
|
||||||
excludeBounceQuery: getExcludeBounceQuery(filters),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,25 +141,6 @@ function getCohortQuery(filters: QueryFilters = {}) {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExcludeBounceQuery(filters: Record<string, any>) {
|
|
||||||
if (!filters.excludeBounce === true) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return `join
|
|
||||||
(select distinct session_id, visit_id
|
|
||||||
from website_event
|
|
||||||
where website_id = {{websiteId}}
|
|
||||||
and created_at between {{startDate}} and {{endDate}}
|
|
||||||
and event_type = 1
|
|
||||||
group by session_id, visit_id
|
|
||||||
having count(*) > 1
|
|
||||||
) excludeBounce
|
|
||||||
on excludeBounce.session_id = website_event.session_id
|
|
||||||
and excludeBounce.visit_id = website_event.visit_id
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDateQuery(filters: Record<string, any>) {
|
function getDateQuery(filters: Record<string, any>) {
|
||||||
const { startDate, endDate } = filters;
|
const { startDate, endDate } = filters;
|
||||||
|
|
||||||
|
|
@ -205,7 +186,6 @@ function parseFilters(filters: Record<string, any>, options?: QueryOptions) {
|
||||||
filterQuery: getFilterQuery(filters, options),
|
filterQuery: getFilterQuery(filters, options),
|
||||||
queryParams: getQueryParams(filters),
|
queryParams: getQueryParams(filters),
|
||||||
cohortQuery: getCohortQuery(cohortFilters),
|
cohortQuery: getCohortQuery(cohortFilters),
|
||||||
excludeBounceQuery: getExcludeBounceQuery(filters),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,10 +140,6 @@ export async function getQueryFilters(
|
||||||
cohort_endDate: endDate,
|
cohort_endDate: endDate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.excludeBounce) {
|
|
||||||
Object.assign(filters, { excludeBounce: true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ export const filterParams = {
|
||||||
segment: z.uuid().optional(),
|
segment: z.uuid().optional(),
|
||||||
cohort: z.uuid().optional(),
|
cohort: z.uuid().optional(),
|
||||||
eventType: z.coerce.number().int().positive().optional(),
|
eventType: z.coerce.number().int().positive().optional(),
|
||||||
excludeBounce: z.string().optional(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchParams = {
|
export const searchParams = {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,6 @@ export interface FilterParams {
|
||||||
segment?: string;
|
segment?: string;
|
||||||
cohort?: string;
|
cohort?: string;
|
||||||
compare?: string;
|
compare?: string;
|
||||||
excludeBounce?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SortParams {
|
export interface SortParams {
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,10 @@ async function relationalQuery(
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<ChannelExpandedMetricsData[]> {
|
): Promise<ChannelExpandedMetricsData[]> {
|
||||||
const { rawQuery, parseFilters, getTimestampDiffSQL } = prisma;
|
const { rawQuery, parseFilters, getTimestampDiffSQL } = prisma;
|
||||||
const { queryParams, filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, dateQuery } =
|
const { queryParams, filterQuery, joinSessionQuery, cohortQuery, dateQuery } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -65,7 +64,6 @@ async function relationalQuery(
|
||||||
max(website_event.created_at) max_time
|
max(website_event.created_at) max_time
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.event_type != 2
|
and website_event.event_type != 2
|
||||||
|
|
@ -121,7 +119,7 @@ async function clickhouseQuery(
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<ChannelExpandedMetricsData[]> {
|
): Promise<ChannelExpandedMetricsData[]> {
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { queryParams, filterQuery, cohortQuery, excludeBounceQuery } = parseFilters({
|
const { queryParams, filterQuery, cohortQuery } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -168,7 +166,6 @@ async function clickhouseQuery(
|
||||||
max(created_at) max_time
|
max(created_at) max_time
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,10 @@ export async function getChannelMetrics(...args: [websiteId: string, filters?: Q
|
||||||
|
|
||||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
const { rawQuery, parseFilters } = prisma;
|
const { rawQuery, parseFilters } = prisma;
|
||||||
const { queryParams, filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, dateQuery } =
|
const { queryParams, filterQuery, joinSessionQuery, cohortQuery, dateQuery } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -42,7 +41,6 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
website_event.session_id
|
website_event.session_id
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.event_type != 2
|
and website_event.event_type != 2
|
||||||
|
|
@ -83,7 +81,7 @@ async function clickhouseQuery(
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<{ x: string; y: number }[]> {
|
): Promise<{ x: string; y: number }[]> {
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { queryParams, filterQuery, cohortQuery, excludeBounceQuery, dateQuery } = parseFilters({
|
const { queryParams, filterQuery, cohortQuery, dateQuery } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -118,7 +116,6 @@ async function clickhouseQuery(
|
||||||
count(distinct session_id) y
|
count(distinct session_id) y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
${dateQuery}
|
${dateQuery}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,10 @@ async function relationalQuery(
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<WebsiteStatsData[]> {
|
): Promise<WebsiteStatsData[]> {
|
||||||
const { getTimestampDiffSQL, parseFilters, rawQuery } = prisma;
|
const { getTimestampDiffSQL, parseFilters, rawQuery } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -51,14 +50,12 @@ async function relationalQuery(
|
||||||
max(website_event.created_at) as "max_time"
|
max(website_event.created_at) as "max_time"
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
and website_event.event_type != 2
|
and website_event.event_type != 2
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
group by 1, 2
|
group by 1, 2
|
||||||
|
|
||||||
) as t
|
) as t
|
||||||
`,
|
`,
|
||||||
queryParams,
|
queryParams,
|
||||||
|
|
@ -71,7 +68,7 @@ async function clickhouseQuery(
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<WebsiteStatsData[]> {
|
): Promise<WebsiteStatsData[]> {
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -95,7 +92,6 @@ async function clickhouseQuery(
|
||||||
max(created_at) max_time
|
max(created_at) max_time
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
@ -119,7 +115,6 @@ async function clickhouseQuery(
|
||||||
max(max_time) max_time
|
max(max_time) max_time
|
||||||
from website_event_stats_hourly "website_event"
|
from website_event_stats_hourly "website_event"
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@ export async function getWeeklyTraffic(...args: [websiteId: string, filters: Que
|
||||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
const { timezone = 'utc' } = filters;
|
const { timezone = 'utc' } = filters;
|
||||||
const { rawQuery, getDateWeeklySQL, parseFilters } = prisma;
|
const { rawQuery, getDateWeeklySQL, parseFilters } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -29,7 +28,6 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
count(distinct website_event.session_id) as value
|
count(distinct website_event.session_id) as value
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
|
@ -45,10 +43,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||||
const { timezone = 'utc' } = filters;
|
const { timezone = 'utc' } = filters;
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = await parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = await parseFilters({ ...filters, websiteId });
|
||||||
...filters,
|
|
||||||
websiteId,
|
|
||||||
});
|
|
||||||
|
|
||||||
let sql = '';
|
let sql = '';
|
||||||
|
|
||||||
|
|
@ -72,7 +67,6 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||||
count(distinct session_id) as value
|
count(distinct session_id) as value
|
||||||
from website_event_stats_hourly website_event
|
from website_event_stats_hourly website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,13 @@ async function relationalQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { rawQuery, parseFilters, getTimestampDiffSQL } = prisma;
|
const { rawQuery, parseFilters, getTimestampDiffSQL } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters(
|
||||||
parseFilters(
|
{
|
||||||
{
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
},
|
||||||
},
|
{ joinSession: SESSION_COLUMNS.includes(type) },
|
||||||
{ joinSession: SESSION_COLUMNS.includes(type) },
|
);
|
||||||
);
|
|
||||||
|
|
||||||
let entryExitQuery = '';
|
let entryExitQuery = '';
|
||||||
let excludeDomain = '';
|
let excludeDomain = '';
|
||||||
|
|
@ -95,7 +94,6 @@ async function relationalQuery(
|
||||||
max(website_event.created_at) as "max_time"
|
max(website_event.created_at) as "max_time"
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
${entryExitQuery}
|
${entryExitQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
|
|
@ -124,7 +122,7 @@ async function clickhouseQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -173,7 +171,6 @@ async function clickhouseQuery(
|
||||||
max(created_at) max_time
|
max(created_at) max_time
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${entryExitQuery}
|
${entryExitQuery}
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,13 @@ async function relationalQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { rawQuery, parseFilters } = prisma;
|
const { rawQuery, parseFilters } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters(
|
||||||
parseFilters(
|
{
|
||||||
{
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
},
|
||||||
},
|
{ joinSession: SESSION_COLUMNS.includes(type) },
|
||||||
{ joinSession: SESSION_COLUMNS.includes(type) },
|
);
|
||||||
);
|
|
||||||
|
|
||||||
let entryExitQuery = '';
|
let entryExitQuery = '';
|
||||||
let excludeDomain = '';
|
let excludeDomain = '';
|
||||||
|
|
@ -76,7 +75,6 @@ async function relationalQuery(
|
||||||
count(distinct website_event.session_id) as y
|
count(distinct website_event.session_id) as y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
${entryExitQuery}
|
${entryExitQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
|
|
@ -102,7 +100,7 @@ async function clickhouseQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -137,7 +135,6 @@ async function clickhouseQuery(
|
||||||
uniq(website_event.session_id) as y
|
uniq(website_event.session_id) as y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${entryExitQuery}
|
${entryExitQuery}
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
|
@ -177,7 +174,6 @@ async function clickhouseQuery(
|
||||||
${columnQuery} as t
|
${columnQuery} as t
|
||||||
from website_event_stats_hourly as website_event
|
from website_event_stats_hourly as website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@ export async function getPageviewStats(...args: [websiteId: string, filters: Que
|
||||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
const { timezone = 'utc', unit = 'day' } = filters;
|
const { timezone = 'utc', unit = 'day' } = filters;
|
||||||
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, joinSessionQuery, queryParams } =
|
const { filterQuery, cohortQuery, joinSessionQuery, queryParams } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -29,7 +28,6 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
count(*) y
|
count(*) y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
|
@ -49,7 +47,7 @@ async function clickhouseQuery(
|
||||||
): Promise<{ x: string; y: number }[]> {
|
): Promise<{ x: string; y: number }[]> {
|
||||||
const { timezone = 'UTC', unit = 'day' } = filters;
|
const { timezone = 'UTC', unit = 'day' } = filters;
|
||||||
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -67,7 +65,6 @@ async function clickhouseQuery(
|
||||||
count(*) as y
|
count(*) as y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
@ -87,7 +84,6 @@ async function clickhouseQuery(
|
||||||
sum(views) as y
|
sum(views) as y
|
||||||
from website_event_stats_hourly as website_event
|
from website_event_stats_hourly as website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,15 @@ async function relationalQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { parseFilters, rawQuery, getTimestampDiffSQL } = prisma;
|
const { parseFilters, rawQuery, getTimestampDiffSQL } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters(
|
||||||
parseFilters(
|
{
|
||||||
{
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
},
|
||||||
},
|
{
|
||||||
{
|
joinSession: SESSION_COLUMNS.includes(type),
|
||||||
joinSession: SESSION_COLUMNS.includes(type),
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
const includeCountry = column === 'city' || column === 'region';
|
const includeCountry = column === 'city' || column === 'region';
|
||||||
|
|
||||||
if (type === 'language') {
|
if (type === 'language') {
|
||||||
|
|
@ -75,7 +74,6 @@ async function relationalQuery(
|
||||||
max(website_event.created_at) as "max_time"
|
max(website_event.created_at) as "max_time"
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
|
@ -104,7 +102,7 @@ async function clickhouseQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { parseFilters, rawQuery } = clickhouse;
|
const { parseFilters, rawQuery } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -135,7 +133,6 @@ async function clickhouseQuery(
|
||||||
max(created_at) max_time
|
max(created_at) max_time
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,15 @@ async function relationalQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { parseFilters, rawQuery } = prisma;
|
const { parseFilters, rawQuery } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters(
|
||||||
parseFilters(
|
{
|
||||||
{
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
},
|
||||||
},
|
{
|
||||||
{
|
joinSession: SESSION_COLUMNS.includes(type),
|
||||||
joinSession: SESSION_COLUMNS.includes(type),
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
const includeCountry = column === 'city' || column === 'region';
|
const includeCountry = column === 'city' || column === 'region';
|
||||||
|
|
||||||
if (type === 'language') {
|
if (type === 'language') {
|
||||||
|
|
@ -53,7 +52,6 @@ async function relationalQuery(
|
||||||
${includeCountry ? ', country' : ''}
|
${includeCountry ? ', country' : ''}
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
|
@ -78,7 +76,7 @@ async function clickhouseQuery(
|
||||||
const { type, limit = 500, offset = 0 } = parameters;
|
const { type, limit = 500, offset = 0 } = parameters;
|
||||||
let column = FILTER_COLUMNS[type] || type;
|
let column = FILTER_COLUMNS[type] || type;
|
||||||
const { parseFilters, rawQuery } = clickhouse;
|
const { parseFilters, rawQuery } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -98,7 +96,6 @@ async function clickhouseQuery(
|
||||||
${includeCountry ? ', country' : ''}
|
${includeCountry ? ', country' : ''}
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
@ -117,7 +114,6 @@ async function clickhouseQuery(
|
||||||
${includeCountry ? ', country' : ''}
|
${includeCountry ? ', country' : ''}
|
||||||
from website_event_stats_hourly as website_event
|
from website_event_stats_hourly as website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@ export async function getSessionStats(...args: [websiteId: string, filters: Quer
|
||||||
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
const { timezone = 'utc', unit = 'day' } = filters;
|
const { timezone = 'utc', unit = 'day' } = filters;
|
||||||
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
const { getDateSQL, parseFilters, rawQuery } = prisma;
|
||||||
const { filterQuery, joinSessionQuery, cohortQuery, excludeBounceQuery, queryParams } =
|
const { filterQuery, joinSessionQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
parseFilters({
|
...filters,
|
||||||
...filters,
|
websiteId,
|
||||||
websiteId,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
`
|
`
|
||||||
|
|
@ -29,7 +28,6 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
count(distinct website_event.session_id) y
|
count(distinct website_event.session_id) y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
${joinSessionQuery}
|
${joinSessionQuery}
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
|
@ -49,7 +47,7 @@ async function clickhouseQuery(
|
||||||
): Promise<{ x: string; y: number }[]> {
|
): Promise<{ x: string; y: number }[]> {
|
||||||
const { timezone = 'UTC', unit = 'day' } = filters;
|
const { timezone = 'UTC', unit = 'day' } = filters;
|
||||||
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
const { parseFilters, rawQuery, getDateSQL } = clickhouse;
|
||||||
const { filterQuery, cohortQuery, excludeBounceQuery, queryParams } = parseFilters({
|
const { filterQuery, cohortQuery, queryParams } = parseFilters({
|
||||||
...filters,
|
...filters,
|
||||||
websiteId,
|
websiteId,
|
||||||
});
|
});
|
||||||
|
|
@ -67,7 +65,6 @@ async function clickhouseQuery(
|
||||||
count(distinct session_id) as y
|
count(distinct session_id) as y
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
@ -87,7 +84,6 @@ async function clickhouseQuery(
|
||||||
uniq(session_id) as y
|
uniq(session_id) as y
|
||||||
from website_event_stats_hourly as website_event
|
from website_event_stats_hourly as website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
${excludeBounceQuery}
|
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type != 2
|
and event_type != 2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue