mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Merge pull request #3157 from DavidVentura/allowCreatedDate
Allow populating event's createdAt on the send endpoint
This commit is contained in:
commit
0a5a79e046
2 changed files with 6 additions and 5 deletions
|
|
@ -122,14 +122,14 @@ export async function POST(request: Request) {
|
|||
}
|
||||
|
||||
// Visit info
|
||||
const now = Math.floor(new Date().getTime() / 1000);
|
||||
const createdAt = Math.floor((reqCreatedAt || new Date()).getTime() / 1000);
|
||||
let visitId = cache?.visitId || uuid(sessionId, visitSalt());
|
||||
let iat = cache?.iat || now;
|
||||
let iat = cache?.iat || createdAt;
|
||||
|
||||
// Expire visit after 30 minutes
|
||||
if (now - iat > 1800) {
|
||||
if (createdAt - iat > 1800) {
|
||||
visitId = uuid(sessionId, visitSalt());
|
||||
iat = now;
|
||||
iat = createdAt;
|
||||
}
|
||||
|
||||
if (type === COLLECTION_TYPE.event) {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ async function relationalQuery(data: {
|
|||
pageTitle: pageTitle?.substring(0, PAGE_TITLE_LENGTH),
|
||||
eventType: eventName ? EVENT_TYPE.customEvent : EVENT_TYPE.pageView,
|
||||
eventName: eventName ? eventName?.substring(0, EVENT_NAME_LENGTH) : null,
|
||||
createdAt,
|
||||
tag,
|
||||
createdAt,
|
||||
},
|
||||
|
|
@ -193,7 +194,7 @@ async function clickhouseQuery(data: {
|
|||
urlPath: urlPath?.substring(0, URL_LENGTH),
|
||||
eventName: eventName?.substring(0, EVENT_NAME_LENGTH),
|
||||
eventData,
|
||||
createdAt,
|
||||
createdAt: createdAtUTC,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue