mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
fix userAgent device type
This commit is contained in:
@@ -76,11 +76,13 @@ async function process_visit(data: Record<string, string>, sessionHash: string)
|
|||||||
|
|
||||||
const userAgentParsed = UAParser(userAgent);
|
const userAgentParsed = UAParser(userAgent);
|
||||||
|
|
||||||
|
const device = userAgentParsed.device.type;
|
||||||
|
|
||||||
const visit = new VisitModel({
|
const visit = new VisitModel({
|
||||||
project_id: pid, website, page, referrer: referrerParsed.hostname,
|
project_id: pid, website, page, referrer: referrerParsed.hostname,
|
||||||
browser: userAgentParsed.browser.name || 'NO_BROWSER',
|
browser: userAgentParsed.browser.name || 'NO_BROWSER',
|
||||||
os: userAgentParsed.os.name || 'NO_OS',
|
os: userAgentParsed.os.name || 'NO_OS',
|
||||||
device: userAgentParsed.device.type,
|
device: device ? device : (userAgentParsed.browser.name ? 'desktop' : undefined),
|
||||||
session: sessionHash,
|
session: sessionHash,
|
||||||
flowHash,
|
flowHash,
|
||||||
continent: geoLocation[0],
|
continent: geoLocation[0],
|
||||||
|
|||||||
Reference in New Issue
Block a user