From 484d5ee4b85fd6808302441647e7584b20bbb36a Mon Sep 17 00:00:00 2001 From: Bill Yang <45103519+goldflag@users.noreply.github.com> Date: Thu, 23 Jan 2025 23:35:16 -0800 Subject: [PATCH] try to remove undefined --- server/src/actions/trackPageView.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/actions/trackPageView.ts b/server/src/actions/trackPageView.ts index 7934fb7..1fc2386 100644 --- a/server/src/actions/trackPageView.ts +++ b/server/src/actions/trackPageView.ts @@ -74,17 +74,17 @@ const updateSession = async ( const inserts = { session_id: pageview.sessionId, user_id: pageview.userId, - hostname: pageview.hostname, - start_time: pageview.timestamp, - last_activity: pageview.timestamp, + hostname: pageview.hostname || "", + start_time: pageview.timestamp || "", + last_activity: pageview.timestamp || "", pageviews: 1, - entry_page: pageview.pathname, + entry_page: pageview.pathname || "", // exit_page: pageview.pathname, device_type: getDeviceType(pageview.screenWidth, pageview.screenHeight), - screen_width: pageview.screenWidth, - screen_height: pageview.screenHeight, - browser: pageview.ua.browser.name, - operating_system: pageview.ua.os.name, + screen_width: pageview.screenWidth || 0, + screen_height: pageview.screenHeight || 0, + browser: pageview.ua.browser.name || "", + operating_system: pageview.ua.os.name || "", language: pageview.language || "", referrer: pageview.referrer || "", };