Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed pixels/links collect.

Mike Caodfe969cabe03
diff --git a/src/app/api/send/route.ts b/src/app/api/send/route.ts
index 3e5699889..f5e00c8aa 100644
--- a/src/app/api/send/route.ts
+++ b/src/app/api/send/route.ts
@@ -82,6 +82,8 @@ export async function POST(request: Request) {
id,
} = payload;
+ const sourceId = websiteId || pixelId || linkId;
+
// Cache check
let cache: Cache | null = null;
@@ -128,13 +130,13 @@ export async function POST(request: Request) {
const sessionSalt = hash(startOfMonth(createdAt).toUTCString());
const visitSalt = hash(startOfHour(createdAt).toUTCString());
- const sessionId = id ? uuid(websiteId, id) : uuid(websiteId, ip, userAgent, sessionSalt);
+ const sessionId = id ? uuid(sourceId, id) : uuid(sourceId, ip, userAgent, sessionSalt);
// Create a session if not found
if (!clickhouse.enabled && !cache?.sessionId) {
await createSession({
id: sessionId,
- websiteId,
+ websiteId: sourceId,
browser,
os,
device,
@@ -206,7 +208,7 @@ export async function POST(request: Request) {
: EVENT_TYPE.pageView;
await saveEvent({
- websiteId: websiteId || linkId || pixelId,
+ websiteId: sourceId,
sessionId,
visitId,
eventType,
@@ -270,6 +272,9 @@ export async function POST(request: Request) {
} catch (e) {
const error = serializeError(e);
+ // eslint-disable-next-line no-console
+ console.log(error);
+
return serverError({ errorObject: error });
}
}