Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Utelater query-parametre fra amplitude logging
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-nom committed Apr 18, 2024
1 parent 7398c1e commit b2fa38e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/utils/analytics/amplitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { InnloggingsstatusState } from '../../store/reducers/innloggingsstatus-d

type EventData = Record<string, any>;

const buildPlatformField = () => {
const { origin, pathname, hash } = window.location;
return `${origin}${pathname}${hash}`;
};

export const initAmplitude = () => {
const userProps = {
skjermbredde: window.screen.width,
Expand All @@ -17,7 +22,7 @@ export const initAmplitude = () => {
saveEvents: false,
includeUtm: true,
includeReferrer: true,
platform: window.location.toString(),
platform: buildPlatformField(),
});
amplitude.getInstance().setUserProperties(userProps);

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b2fa38e

Please sign in to comment.