diff --git a/package-lock.json b/package-lock.json index 6d75e34cb..d17e5a136 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13892,9 +13892,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001570", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", - "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", + "version": "1.0.30001571", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001571.tgz", + "integrity": "sha512-tYq/6MoXhdezDLFZuCO/TKboTzuQ/xR5cFdgXPfDtM7/kchBO3b4VWghE/OAi/DV7tTdhmLjZiZBZi1fA/GheQ==", "funding": [ { "type": "opencollective", diff --git a/src/components/atoms/activeLink.tsx b/src/components/atoms/activeLink.tsx index 4b2ab3e4c..9de8245ff 100644 --- a/src/components/atoms/activeLink.tsx +++ b/src/components/atoms/activeLink.tsx @@ -3,10 +3,13 @@ import Link, { LinkProps } from 'next/link'; import { useRouter } from 'next/router'; import React, { ReactElement } from 'react'; +import { analytics } from './analytics'; + type ActiveLinkProps = LinkProps & { children: ReactElement; className?: string; activeClassName: string; + linkLabel?: string; }; // SOURCE: https://zaiste.net/programming/reactjs/howtos/create-activelink-nextjs/ @@ -15,6 +18,7 @@ const ActiveLink = ({ children, className, activeClassName, + linkLabel, ...props }: ActiveLinkProps): JSX.Element => { const { asPath } = useRouter(); @@ -29,6 +33,9 @@ const ActiveLink = ({ { + analytics.track('menuClick', { lable: linkLabel }); + }} > {children} diff --git a/src/components/molecules/navItem.tsx b/src/components/molecules/navItem.tsx index f58e096ea..fa9a7706c 100644 --- a/src/components/molecules/navItem.tsx +++ b/src/components/molecules/navItem.tsx @@ -6,6 +6,8 @@ import styles from '~components/organisms/navigation.module.scss'; import { INavigationItem } from '~lib/useNavigationItems'; import IconDisclosure from '~public/img/icons/icon-disclosure-light-small.svg'; +import { analytics } from '../atoms/analytics'; + export default function NavItem({ item, setSubmenu, @@ -29,11 +31,17 @@ export default function NavItem({ href={href} className={styles.navLink} activeClassName={styles.active} + linkLabel={label} > {inner} ) : ( - setSubmenu(key)}> + { + analytics.track('menuClick', { link: label }), setSubmenu(key); + }} + > {inner} )}