Add click heatmaps report

Extracts click events from rrweb session-replay buffers at write time
into a new heatmap_event table (Prisma + ClickHouse). New /heatmaps
report shows a page picker plus an overlay of click density on the
dominant viewport, with an optional iframe of the live page behind.
This commit is contained in:
Mike Cao committed 2026-04-27 22:20:38 -07:00
1 parent 9da332c489
commit a6b13b71db
18 files changed
+831

No files matched your search

+5
View File
@@ -119,6 +119,11 @@ export const EVENT_TYPE = {
performance: 5,
} as const;
export const HEATMAP_EVENT_TYPE = {
click: 1,
scroll: 2,
} as const;
export const ENTITY_TYPE = {
website: 1,
link: 2,
+11
View File
@@ -131,6 +131,7 @@ export const reportTypeParam = z.enum([
'breakdown',
'funnel',
'goal',
'heatmap',
'journey',
'performance',
'retention',
@@ -268,6 +269,15 @@ export const breakdownReportSchema = z.object({
}),
});
export const heatmapReportSchema = z.object({
type: z.literal('heatmap'),
parameters: z.object({
startDate: z.coerce.date(),
endDate: z.coerce.date(),
urlPath: z.string().max(500).optional(),
}),
});
export const reportBaseSchema = z.object({
websiteId: z.uuid(),
type: reportTypeParam,
@@ -286,6 +296,7 @@ export const reportTypeSchema = z.discriminatedUnion('type', [
revenueReportSchema,
attributionReportSchema,
breakdownReportSchema,
heatmapReportSchema,
]);
export const reportSchema = reportBaseSchema;