From b2fa38ef3a5a06729f0e12c37568803bbc4e9af8 Mon Sep 17 00:00:00 2001 From: Anders Nomerstad Date: Thu, 18 Apr 2024 15:08:07 +0200 Subject: [PATCH] Utelater query-parametre fra amplitude logging --- src/utils/analytics/amplitude.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/analytics/amplitude.ts b/src/utils/analytics/amplitude.ts index 83ce5b9c7..7e80bc794 100644 --- a/src/utils/analytics/amplitude.ts +++ b/src/utils/analytics/amplitude.ts @@ -4,6 +4,11 @@ import { InnloggingsstatusState } from '../../store/reducers/innloggingsstatus-d type EventData = Record; +const buildPlatformField = () => { + const { origin, pathname, hash } = window.location; + return `${origin}${pathname}${hash}`; +}; + export const initAmplitude = () => { const userProps = { skjermbredde: window.screen.width, @@ -17,7 +22,7 @@ export const initAmplitude = () => { saveEvents: false, includeUtm: true, includeReferrer: true, - platform: window.location.toString(), + platform: buildPlatformField(), }); amplitude.getInstance().setUserProperties(userProps); @@ -73,7 +78,7 @@ export const logAmplitudeEvent = (eventName: string, eventData: EventData = {}, eventName, { ...eventData, - platform: window.location.toString(), + platform: buildPlatformField(), origin, originVersion: eventData.originVersion || 'unknown', viaDekoratoren: true,