initial setup. add crossdomain tracking.

This commit is contained in:
Sergei Meza 2022-10-13 18:18:59 +09:00
parent 0cb14f3f6c
commit fa4130ebce
6 changed files with 196 additions and 2 deletions

View file

@ -47,7 +47,10 @@ export async function getSession(req) {
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
const session_uuid = uuid(websiteId, hostname, ip, userAgent);
let session_uuid = uuid(websiteId, hostname, ip, userAgent);
if (process.env.CROSSDOMAIN_TRACKING) {
session_uuid = uuid(websiteId, ip, userAgent);
}
let sessionCreated = false;
let sessionId = null;
@ -76,6 +79,8 @@ export async function getSession(req) {
language,
country,
device,
ip,
user_agent: userAgent,
});
sessionId = session ? session.session_id : null;