Skip to content

Commit c78ff36

Browse files
authored
Merge pull request #4162 from umami-software/dev
v3.1.0
2 parents 0a83864 + f15547e commit c78ff36

685 files changed

Lines changed: 42532 additions & 145396 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/1.bug_report.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ body:
2424
render: shell
2525
- type: input
2626
attributes:
27-
label: Which Umami version are you using? (if relevant)
27+
label: Which Umami version are you using?
2828
description: 'For example: 2.18.0, 2.15.1, 1.39.0, etc'
2929
- type: input
3030
attributes:
31-
label: Which browser are you using? (if relevant)
32-
description: 'For example: Chrome, Edge, Firefox, etc'
31+
label: How are you deploying your application?
32+
description: 'For example: Vercel, Railway, Docker, etc'
3333
- type: input
3434
attributes:
35-
label: How are you deploying your application? (if relevant)
36-
description: 'For example: Vercel, Railway, Docker, etc'
35+
label: Which browser are you using?
36+
description: 'For example: Chrome, Edge, Firefox, etc'

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ jobs:
124124
push: true
125125
tags: ${{ steps.compute.outputs.docker_tags }}
126126
cache-from: type=gha
127-
cache-to: type=gha,mode=max
127+
cache-to: type=gha,mode=max

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
with:
1818
version: 10
1919
run_install: false
20-
- name: Use Node.js 18.18
20+
- name: Use Node.js 22
2121
uses: actions/setup-node@v4
2222
with:
23-
node-version: 18.18
23+
node-version: 22
2424
cache: "pnpm"
2525
- run: npm install --global pnpm
2626
- run: pnpm install

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ package-lock.json
1111
/coverage
1212

1313
# next.js
14+
next-env.d.ts
1415
/.next
1516
/out
1617

1718
# production
1819
/build
1920
/public/script.js
21+
/public/recorder.js
2022
/geo
2123
/dist
2224
/generated
2325
/src/generated
26+
pm2.yml
2427

2528
# misc
2629
.DS_Store
@@ -30,6 +33,11 @@ package-lock.json
3033
*.log
3134
.vscode
3235
.tool-versions
36+
.claude
37+
.agents
38+
tmpclaude*
39+
CLAUDE.md
40+
nul
3341

3442
# debug
3543
npm-debug.log*
@@ -42,4 +50,3 @@ yarn-error.log*
4250
*.env.*
4351

4452
*.dev.yml
45-

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

.stylelintrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FROM node:${NODE_IMAGE_VERSION} AS builder
1414
WORKDIR /app
1515
COPY --from=deps /app/node_modules ./node_modules
1616
COPY . .
17-
COPY docker/middleware.ts ./src
17+
COPY docker/proxy.ts ./src
1818

1919
ARG BASE_PATH
2020

@@ -28,7 +28,7 @@ RUN npm run build-docker
2828
FROM node:${NODE_IMAGE_VERSION} AS runner
2929
WORKDIR /app
3030

31-
ARG PRISMA_VERSION="6.19.0"
31+
ARG PRISMA_VERSION="7.3.0"
3232
ARG NODE_OPTIONS
3333

3434
ENV NODE_ENV=production
@@ -44,10 +44,12 @@ RUN set -x \
4444
# Script dependencies
4545
RUN pnpm --allow-build='@prisma/engines' add npm-run-all dotenv chalk semver \
4646
prisma@${PRISMA_VERSION} \
47+
@prisma/client@${PRISMA_VERSION} \
4748
@prisma/adapter-pg@${PRISMA_VERSION}
4849

4950
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
5051
COPY --from=builder /app/prisma ./prisma
52+
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
5153
COPY --from=builder /app/scripts ./scripts
5254
COPY --from=builder /app/generated ./generated
5355

@@ -63,4 +65,4 @@ EXPOSE 3000
6365
ENV HOSTNAME=0.0.0.0
6466
ENV PORT=3000
6567

66-
CMD ["pnpm", "start-docker"]
68+
CMD ["pnpm", "start-docker"]
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
-- Add performance columns to website_event
2+
ALTER TABLE umami.website_event ADD COLUMN lcp Nullable(Decimal(10, 1)) AFTER twclid;
3+
ALTER TABLE umami.website_event ADD COLUMN inp Nullable(Decimal(10, 1)) AFTER lcp;
4+
ALTER TABLE umami.website_event ADD COLUMN cls Nullable(Decimal(10, 4)) AFTER inp;
5+
ALTER TABLE umami.website_event ADD COLUMN fcp Nullable(Decimal(10, 1)) AFTER cls;
6+
ALTER TABLE umami.website_event ADD COLUMN ttfb Nullable(Decimal(10, 1)) AFTER fcp;
7+
8+
-- Update materialized view to exclude performance events from view counts
9+
DROP TABLE umami.website_event_stats_hourly_mv;
10+
11+
CREATE MATERIALIZED VIEW umami.website_event_stats_hourly_mv
12+
TO umami.website_event_stats_hourly
13+
AS
14+
SELECT
15+
website_id,
16+
session_id,
17+
visit_id,
18+
hostnames as hostname,
19+
browser,
20+
os,
21+
device,
22+
screen,
23+
language,
24+
country,
25+
region,
26+
city,
27+
entry_url,
28+
exit_url,
29+
url_paths as url_path,
30+
url_query,
31+
utm_source,
32+
utm_medium,
33+
utm_campaign,
34+
utm_content,
35+
utm_term,
36+
referrer_domain,
37+
page_title,
38+
gclid,
39+
fbclid,
40+
msclkid,
41+
ttclid,
42+
li_fat_id,
43+
twclid,
44+
event_type,
45+
event_name,
46+
views,
47+
min_time,
48+
max_time,
49+
tag,
50+
distinct_id,
51+
timestamp as created_at
52+
FROM (SELECT
53+
website_id,
54+
session_id,
55+
visit_id,
56+
arrayFilter(x -> x != '', groupArray(hostname)) hostnames,
57+
browser,
58+
os,
59+
device,
60+
screen,
61+
language,
62+
country,
63+
region,
64+
city,
65+
argMinState(url_path, created_at) entry_url,
66+
argMaxState(url_path, created_at) exit_url,
67+
arrayFilter(x -> x != '', groupArray(url_path)) as url_paths,
68+
arrayFilter(x -> x != '', groupArray(url_query)) url_query,
69+
arrayFilter(x -> x != '', groupArray(utm_source)) utm_source,
70+
arrayFilter(x -> x != '', groupArray(utm_medium)) utm_medium,
71+
arrayFilter(x -> x != '', groupArray(utm_campaign)) utm_campaign,
72+
arrayFilter(x -> x != '', groupArray(utm_content)) utm_content,
73+
arrayFilter(x -> x != '', groupArray(utm_term)) utm_term,
74+
arrayFilter(x -> x != '' and x != hostname, groupArray(referrer_domain)) referrer_domain,
75+
arrayFilter(x -> x != '', groupArray(page_title)) page_title,
76+
arrayFilter(x -> x != '', groupArray(gclid)) gclid,
77+
arrayFilter(x -> x != '', groupArray(fbclid)) fbclid,
78+
arrayFilter(x -> x != '', groupArray(msclkid)) msclkid,
79+
arrayFilter(x -> x != '', groupArray(ttclid)) ttclid,
80+
arrayFilter(x -> x != '', groupArray(li_fat_id)) li_fat_id,
81+
arrayFilter(x -> x != '', groupArray(twclid)) twclid,
82+
event_type,
83+
if(event_type = 2, groupArray(event_name), []) event_name,
84+
sumIf(1, event_type NOT IN (2, 5)) views,
85+
min(created_at) min_time,
86+
max(created_at) max_time,
87+
arrayFilter(x -> x != '', groupArray(tag)) tag,
88+
distinct_id,
89+
toStartOfHour(created_at) timestamp
90+
FROM umami.website_event
91+
GROUP BY website_id,
92+
session_id,
93+
visit_id,
94+
hostname,
95+
browser,
96+
os,
97+
device,
98+
screen,
99+
language,
100+
country,
101+
region,
102+
city,
103+
event_type,
104+
distinct_id,
105+
timestamp);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Create session_replay
2+
CREATE TABLE umami.session_replay
3+
(
4+
replay_id UUID,
5+
website_id UUID,
6+
session_id UUID,
7+
visit_id UUID,
8+
chunk_index UInt32,
9+
events String CODEC(ZSTD(3)),
10+
event_count UInt32,
11+
started_at DateTime64(6),
12+
ended_at DateTime64(6),
13+
created_at DateTime64(6) DEFAULT now64(6)
14+
)
15+
ENGINE = MergeTree()
16+
PARTITION BY toYYYYMM(created_at)
17+
ORDER BY (replay_id, website_id, session_id, visit_id, chunk_index)
18+
SETTINGS index_granularity = 8192;

db/clickhouse/schema.sql

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ CREATE TABLE umami.website_event
3434
ttclid String,
3535
li_fat_id String,
3636
twclid String,
37+
--performance
38+
lcp Nullable(Decimal(10, 1)),
39+
inp Nullable(Decimal(10, 1)),
40+
cls Nullable(Decimal(10, 4)),
41+
fcp Nullable(Decimal(10, 1)),
42+
ttfb Nullable(Decimal(10, 1)),
3743
--events
3844
event_type UInt32,
3945
event_name String,
@@ -209,7 +215,7 @@ FROM (SELECT
209215
arrayFilter(x -> x != '', groupArray(twclid)) twclid,
210216
event_type,
211217
if(event_type = 2, groupArray(event_name), []) event_name,
212-
sumIf(1, event_type != 2) views,
218+
sumIf(1, event_type NOT IN (2, 5)) views,
213219
min(created_at) min_time,
214220
max(created_at) max_time,
215221
arrayFilter(x -> x != '', groupArray(tag)) tag,
@@ -281,3 +287,22 @@ JOIN (SELECT event_id, string_value as currency
281287
WHERE positionCaseInsensitive(data_key, 'currency') > 0) c
282288
ON c.event_id = ed.event_id
283289
WHERE positionCaseInsensitive(data_key, 'revenue') > 0;
290+
291+
-- Create session_replay
292+
CREATE TABLE umami.session_replay
293+
(
294+
replay_id UUID,
295+
website_id UUID,
296+
session_id UUID,
297+
visit_id UUID,
298+
chunk_index UInt32,
299+
events String CODEC(ZSTD(3)),
300+
event_count UInt32,
301+
started_at DateTime64(6),
302+
ended_at DateTime64(6),
303+
created_at DateTime64(6) DEFAULT now64(6)
304+
)
305+
ENGINE = MergeTree()
306+
PARTITION BY toYYYYMM(created_at)
307+
ORDER BY (replay_id, website_id, session_id, visit_id, chunk_index)
308+
SETTINGS index_granularity = 8192;

0 commit comments

Comments
 (0)