Skip to content

Commit

Permalink
IS-2854: måle hvilke søkefelt som blir brukt
Browse files Browse the repository at this point in the history
  • Loading branch information
ingring committed Dec 5, 2024
1 parent 2cc0b10 commit 57cf7d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/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 57cf7d4

Please sign in to comment.