mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Pixel route.
This commit is contained in:
parent
3c5c1e48e9
commit
0ac8bd41b6
10 changed files with 139 additions and 64 deletions
|
|
@ -11,8 +11,8 @@ export interface SaveEventArgs {
|
|||
websiteId: string;
|
||||
sessionId: string;
|
||||
visitId: string;
|
||||
eventType: number;
|
||||
createdAt?: Date;
|
||||
eventType?: number;
|
||||
|
||||
// Page
|
||||
pageTitle?: string;
|
||||
|
|
@ -115,7 +115,7 @@ async function relationalQuery({
|
|||
ttclid,
|
||||
lifatid,
|
||||
twclid,
|
||||
eventType: eventType || (eventName ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView),
|
||||
eventType,
|
||||
eventName: eventName ? eventName?.substring(0, EVENT_NAME_LENGTH) : null,
|
||||
tag,
|
||||
hostname,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import { Prisma } from '@/generated/prisma/client';
|
||||
import prisma from '@/lib/prisma';
|
||||
|
||||
export async function createSession(
|
||||
data: Prisma.SessionCreateInput,
|
||||
options = { skipDuplicates: false },
|
||||
) {
|
||||
export async function createSession(data: Prisma.SessionCreateInput) {
|
||||
const {
|
||||
id,
|
||||
websiteId,
|
||||
|
|
@ -36,12 +33,7 @@ export async function createSession(
|
|||
},
|
||||
});
|
||||
} catch (e: any) {
|
||||
// With skipDuplicates flag: ignore unique constraint error and return null
|
||||
if (
|
||||
options.skipDuplicates &&
|
||||
e instanceof Prisma.PrismaClientKnownRequestError &&
|
||||
e.code === 'P2002'
|
||||
) {
|
||||
if (e.message.toLowerCase().includes('unique constraint')) {
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue