Skip to content

Commit

Permalink
IS-2854: måle hvilke søkefelt som blir brukt (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
ingring authored Dec 6, 2024
1 parent 0409332 commit 3d0c8d1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sider/sokperson/SokPerson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ const texts = {
error: 'Noe gikk galt under søket. Vennligst prøv igjen.',
};

function logSokPersonEvent() {
function logSokPersonEvent(requestDTO: SokDTO) {
const hasInitials = !!requestDTO.initials;
const hasBirthdate = !!requestDTO.birthdate;
Amplitude.logEvent({
type: Amplitude.EventType.ButtonClick,
data: {
url: window.location.href,
tekst: 'Søk etter sykmeldt',
tekst:
'Søk etter sykmeldt -' +
(hasBirthdate ? ' fødselsdato' : '') +
(hasInitials ? ' initialer' : ''),
},
});
}
Expand Down Expand Up @@ -85,7 +90,7 @@ export default function SokPerson() {
};
mutate(requestDTO, {
onSuccess: (data) => logSokPersonResults(data.length),
onSettled: () => logSokPersonEvent(),
onSettled: () => logSokPersonEvent(requestDTO),
});
} else {
setIsFormError(true);
Expand Down

0 comments on commit 3d0c8d1

Please sign in to comment.