Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opprydding Amplitude for Filtervalg og Accordion #1989

Merged
merged 7 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/_common/accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export const Accordion = ({ accordion }: AccordionProps) => {

useShortcuts({ shortcut: Shortcuts.SEARCH, callback: expandAll });

const openChangeHandler = (isOpen: boolean, title: string, index: number) => {
if (isOpen) {
const openChangeHandler = (isOpening: boolean, title: string, index: number) => {
if (isOpening) {
setOpenAccordions([...openAccordions, index]);
} else {
setOpenAccordions(openAccordions.filter((i) => i !== index));
}
logAmplitudeEvent(isOpen ? AnalyticsEvents.ACC_COLLAPSE : AnalyticsEvents.ACC_EXPAND, {
logAmplitudeEvent(isOpening ? AnalyticsEvents.ACC_EXPAND : AnalyticsEvents.ACC_COLLAPSE, {
tittel: title,
opprinnelse: 'trekkspill',
});
Expand Down
1 change: 1 addition & 0 deletions src/components/_common/filter-bar/FilterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const FilterBar = ({ layoutProps }: Props) => {
kategori: filter.categoryName,
filternavn: filter.filterName,
opprinnelse: 'innholdtekst',
komponent: 'FilterBar',
});
saveScrollPosition();
toggleFilter(filter.id);
Expand Down
4 changes: 3 additions & 1 deletion src/components/_common/overview-filters/OverviewFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { FunnelIcon } from '@navikt/aksel-icons';
import { Heading, Button } from '@navikt/ds-react';
import { Button, Heading } from '@navikt/ds-react';
import { OverviewAreaFilter } from 'components/_common/overview-filters/area-filter/OverviewAreaFilter';
import { OverviewTaxonomyFilter } from 'components/_common/overview-filters/taxonomy-filter/OverviewTaxonomyFilter';
import { OverviewTextFilter } from 'components/_common/overview-filters/text-filter/OverviewTextFilter';
Expand Down Expand Up @@ -50,7 +50,9 @@ const MobileView = ({
e.preventDefault();
setIsOpen(!isOpen);
logAmplitudeEvent(AnalyticsEvents.FILTER, {
kategori: 'mobile-toggle',
opprinnelse: 'oversiktsside filter mobil',
komponent: 'MobileView',
});
}}
className={style.mobileFilterButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const OverviewAreaFilter = ({ items }: Props) => {

const handleFilterUpdate = (area: Area) => {
logAmplitudeEvent(AnalyticsEvents.FILTER, {
omrade: area,
kategori: 'område',
filternavn: area,
opprinnelse: 'oversiktsside områder',
komponent: 'OverviewAreaFilter',
});
setAreaFilter(area);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ export const OverviewTaxonomyFilter = ({ items }: Props) => {

const handleFilterUpdate = (taxonomy: ProductTaxonomy) => {
logAmplitudeEvent(AnalyticsEvents.FILTER, {
type: taxonomy,
kategori: 'type',
filternavn: taxonomy,
opprinnelse: 'oversiktsside typer',
komponent: 'OverviewTaxonomyFilter',
});
setTaxonomyFilter(taxonomy);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export const OverviewTextFilter = ({ hideLabel }: Props) => {
)
);
logAmplitudeEvent(AnalyticsEvents.FILTER, {
komponent: 'skjemaoversikt-filter',
filtertekst: value,
kategori: 'fritekst',
filternavn: value,
komponent: 'OverviewTextFilter',
});
}, 500),
[setTextFilter]
Expand Down
1 change: 1 addition & 0 deletions src/components/parts/filters-menu/FiltersMenuPart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const FiltersMenuPart = ({ config, path }: PartComponentProps<PartType.Fi
kategori: category.categoryName,
filternavn: filter.filterName,
opprinnelse: 'filtermeny',
komponent: 'FiltersMenuPart',
});
toggleFilter(filter.id);
};
Expand Down
Loading