mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-21 17:37:00 +01:00
change views back to pageviews
This commit is contained in:
parent
d945ed3a23
commit
ab58c76b6a
@ -78,7 +78,6 @@ FROM umami.website_event we
|
|||||||
JOIN umami.website_event_join j
|
JOIN umami.website_event_join j
|
||||||
ON we.session_id = j.session_id
|
ON we.session_id = j.session_id
|
||||||
and date_trunc('hour', we.created_at) = j.created_at
|
and date_trunc('hour', we.created_at) = j.created_at
|
||||||
WHERE we.created_at > '2023-03-31';
|
|
||||||
|
|
||||||
RENAME TABLE umami.website_event TO umami.website_event_old;
|
RENAME TABLE umami.website_event TO umami.website_event_old;
|
||||||
RENAME TABLE umami.website_event_new TO umami.website_event;
|
RENAME TABLE umami.website_event_new TO umami.website_event;
|
||||||
|
@ -21,10 +21,10 @@ export function WebsiteMetricsBar({
|
|||||||
const { ref, isSticky } = useSticky({ enabled: sticky });
|
const { ref, isSticky } = useSticky({ enabled: sticky });
|
||||||
const { data, isLoading, isFetched, error } = useWebsiteStats(websiteId);
|
const { data, isLoading, isFetched, error } = useWebsiteStats(websiteId);
|
||||||
|
|
||||||
const { views, visitors, visits, bounces, totaltime } = data || {};
|
const { pageviews, visitors, visits, bounces, totaltime } = data || {};
|
||||||
const num = Math.min(data && visitors.value, data && bounces.value);
|
const num = Math.min(data && visitors.value, data && bounces.value);
|
||||||
const diffs = data && {
|
const diffs = data && {
|
||||||
views: views.value - views.change,
|
pageviews: pageviews.value - pageviews.change,
|
||||||
visitors: visitors.value - visitors.change,
|
visitors: visitors.value - visitors.change,
|
||||||
visits: visits.value - visits.change,
|
visits: visits.value - visits.change,
|
||||||
bounces: bounces.value - bounces.change,
|
bounces: bounces.value - bounces.change,
|
||||||
@ -40,12 +40,12 @@ export function WebsiteMetricsBar({
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<MetricsBar isLoading={isLoading} isFetched={isFetched} error={error}>
|
<MetricsBar isLoading={isLoading} isFetched={isFetched} error={error}>
|
||||||
{views && visitors && (
|
{pageviews && visitors && (
|
||||||
<>
|
<>
|
||||||
<MetricCard
|
<MetricCard
|
||||||
label={formatMessage(labels.views)}
|
label={formatMessage(labels.pageviews)}
|
||||||
value={views.value}
|
value={pageviews.value}
|
||||||
change={views.change}
|
change={pageviews.change}
|
||||||
/>
|
/>
|
||||||
<MetricCard
|
<MetricCard
|
||||||
label={formatMessage(labels.visits)}
|
label={formatMessage(labels.visits)}
|
||||||
@ -72,12 +72,14 @@ export function WebsiteMetricsBar({
|
|||||||
<MetricCard
|
<MetricCard
|
||||||
label={formatMessage(labels.averageVisitTime)}
|
label={formatMessage(labels.averageVisitTime)}
|
||||||
value={
|
value={
|
||||||
totaltime.value && views.value ? totaltime.value / (views.value - bounces.value) : 0
|
totaltime.value && pageviews.value
|
||||||
|
? totaltime.value / (pageviews.value - bounces.value)
|
||||||
|
: 0
|
||||||
}
|
}
|
||||||
change={
|
change={
|
||||||
totaltime.value && views.value
|
totaltime.value && pageviews.value
|
||||||
? (diffs.totaltime / (diffs.views - diffs.bounces) -
|
? (diffs.totaltime / (diffs.pageviews - diffs.bounces) -
|
||||||
totaltime.value / (views.value - bounces.value)) *
|
totaltime.value / (pageviews.value - bounces.value)) *
|
||||||
-1 || 0
|
-1 || 0
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import { QueryFilters } from 'lib/types';
|
|||||||
export async function getWebsiteStats(
|
export async function getWebsiteStats(
|
||||||
...args: [websiteId: string, filters: QueryFilters]
|
...args: [websiteId: string, filters: QueryFilters]
|
||||||
): Promise<
|
): Promise<
|
||||||
{ views: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
{ pageviews: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
||||||
> {
|
> {
|
||||||
return runQuery({
|
return runQuery({
|
||||||
[PRISMA]: () => relationalQuery(...args),
|
[PRISMA]: () => relationalQuery(...args),
|
||||||
@ -19,7 +19,7 @@ async function relationalQuery(
|
|||||||
websiteId: string,
|
websiteId: string,
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<
|
): Promise<
|
||||||
{ views: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
{ pageviews: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
||||||
> {
|
> {
|
||||||
const { getTimestampDiffQuery, parseFilters, rawQuery } = prisma;
|
const { getTimestampDiffQuery, parseFilters, rawQuery } = prisma;
|
||||||
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
const { filterQuery, joinSession, params } = await parseFilters(websiteId, {
|
||||||
@ -61,7 +61,7 @@ async function clickhouseQuery(
|
|||||||
websiteId: string,
|
websiteId: string,
|
||||||
filters: QueryFilters,
|
filters: QueryFilters,
|
||||||
): Promise<
|
): Promise<
|
||||||
{ views: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
{ pageviews: number; visitors: number; visits: number; bounces: number; totaltime: number }[]
|
||||||
> {
|
> {
|
||||||
const { rawQuery, parseFilters } = clickhouse;
|
const { rawQuery, parseFilters } = clickhouse;
|
||||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||||
@ -96,7 +96,7 @@ async function clickhouseQuery(
|
|||||||
).then(a => {
|
).then(a => {
|
||||||
return Object.values(a).map(a => {
|
return Object.values(a).map(a => {
|
||||||
return {
|
return {
|
||||||
views: Number(a.views),
|
pageviews: Number(a.views),
|
||||||
visitors: Number(a.visitors),
|
visitors: Number(a.visitors),
|
||||||
visits: Number(a.visits),
|
visits: Number(a.visits),
|
||||||
bounces: Number(a.bounces),
|
bounces: Number(a.bounces),
|
||||||
|
Loading…
Reference in New Issue
Block a user