mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
update pageview, event save
This commit is contained in:
parent
cfa36d1802
commit
7596f42545
2 changed files with 53 additions and 24 deletions
|
|
@ -8,8 +8,8 @@ import cache from 'lib/cache';
|
|||
export async function saveEvent(args: {
|
||||
id: string;
|
||||
websiteId: string;
|
||||
url: string;
|
||||
referrer?: string;
|
||||
urlPath: string;
|
||||
urlQuery?: string;
|
||||
pageTitle?: string;
|
||||
eventName?: string;
|
||||
hostname?: string;
|
||||
|
|
@ -32,20 +32,20 @@ export async function saveEvent(args: {
|
|||
async function relationalQuery(data: {
|
||||
id: string;
|
||||
websiteId: string;
|
||||
url: string;
|
||||
referrer?: string;
|
||||
urlPath: string;
|
||||
urlQuery?: string;
|
||||
pageTitle?: string;
|
||||
eventName?: string;
|
||||
}) {
|
||||
const { websiteId, id: sessionId, url, eventName, referrer, pageTitle } = data;
|
||||
const { websiteId, id: sessionId, urlPath, urlQuery, eventName, pageTitle } = data;
|
||||
|
||||
return prisma.client.websiteEvent.create({
|
||||
data: {
|
||||
id: uuid(),
|
||||
websiteId,
|
||||
sessionId,
|
||||
url: url?.substring(0, URL_LENGTH),
|
||||
referrer: referrer?.substring(0, URL_LENGTH),
|
||||
urlPath: urlPath?.substring(0, URL_LENGTH),
|
||||
urlQuery: urlQuery?.substring(0, URL_LENGTH),
|
||||
pageTitle: pageTitle,
|
||||
eventType: EVENT_TYPE.customEvent,
|
||||
eventName: eventName?.substring(0, EVENT_NAME_LENGTH),
|
||||
|
|
@ -56,8 +56,8 @@ async function relationalQuery(data: {
|
|||
async function clickhouseQuery(data: {
|
||||
id: string;
|
||||
websiteId: string;
|
||||
url: string;
|
||||
referrer?: string;
|
||||
urlPath: string;
|
||||
urlQuery?: string;
|
||||
pageTitle?: string;
|
||||
eventName?: string;
|
||||
hostname?: string;
|
||||
|
|
@ -74,7 +74,8 @@ async function clickhouseQuery(data: {
|
|||
const {
|
||||
websiteId,
|
||||
id: sessionId,
|
||||
url,
|
||||
urlPath,
|
||||
urlQuery,
|
||||
pageTitle,
|
||||
eventName,
|
||||
country,
|
||||
|
|
@ -94,7 +95,8 @@ async function clickhouseQuery(data: {
|
|||
subdivision1: subdivision1 ? subdivision1 : null,
|
||||
subdivision2: subdivision2 ? subdivision2 : null,
|
||||
city: city ? city : null,
|
||||
url: url?.substring(0, URL_LENGTH),
|
||||
urlPath: urlPath?.substring(0, URL_LENGTH),
|
||||
urlQuery: urlQuery?.substring(0, URL_LENGTH),
|
||||
page_title: pageTitle,
|
||||
event_type: EVENT_TYPE.customEvent,
|
||||
event_name: eventName?.substring(0, EVENT_NAME_LENGTH),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue