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

Commit

Permalink
Merge pull request #879 from navikt/dev/amplitude-url
Browse files Browse the repository at this point in the history
Amplitudefelt for om url er minside eller underside
  • Loading branch information
anehs authored Aug 24, 2023
2 parents 33f9f93 + c183ce4 commit 9d956c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/komponenter/hent-initial-data/amplitude-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const initialAmplitudeData: AmplitudeData = {
levertMeldekortEtterInaktvering: 'INGEN_DATA',
automatiskReaktivert: 'INGEN_DATA',
automatiskReaktivertSvar: 'INGEN_DATA',
loggetFraSide: 'INGEN_DATA',
};

const AmplitudeContext = createContext({
Expand Down Expand Up @@ -118,6 +119,9 @@ const AmplitudeProvider = (props: { children: React.ReactNode }) => {
const valgtSprak = hentSprakValgFraCookie();
const sprakValgFraCookie = valgtSprak || 'IKKE_VALGT';

const url = window.location.href;
const loggetFraSide = url.includes('arbeidssoker') ? 'Side 2' : 'Min side';

const data: AmplitudeData = {
...initialAmplitudeData,
brukergruppe: beregnBrukergruppe({
Expand Down Expand Up @@ -147,6 +151,7 @@ const AmplitudeProvider = (props: { children: React.ReactNode }) => {
antallDagerSidenSisteArbeidssokerperiode,
antallUkerSidenSisteArbeidssokerperiode,
antallUkerMellomSisteArbeidssokerperioder,
loggetFraSide,
};

const [amplitudeData, setAmplitudeData] = React.useState(data);
Expand Down
1 change: 1 addition & 0 deletions src/metrics/amplitude-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export type AmplitudeData = {
levertMeldekortEtterInaktvering: 'INGEN_DATA' | 'Ja' | 'Nei';
automatiskReaktivert: 'INGEN_DATA' | 'Ja';
automatiskReaktivertSvar: 'INGEN_DATA' | 'Ikke svart' | 'ja' | 'nei';
loggetFraSide: 'Min side' | 'Side 2' | 'INGEN_DATA';
};

export function amplitudeLogger(name: string, values?: object) {
Expand Down

0 comments on commit 9d956c9

Please sign in to comment.