From e7dc85dd45a077d48f8f8338c349e238d4976747 Mon Sep 17 00:00:00 2001 From: Okeino McGowan Date: Tue, 26 Dec 2023 09:57:53 -0500 Subject: [PATCH 1/3] dev writekey --- package-lock.json | 6 +++--- src/components/atoms/analytics.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c254aa53..d17e5a136 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13892,9 +13892,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001568", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001568.tgz", - "integrity": "sha512-vSUkH84HontZJ88MiNrOau1EBrCqEQYgkC5gIySiDlpsm8sGVrhU7Kx4V6h0tnqaHzIHZv08HlJIwPbL4XL9+A==", + "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/analytics.tsx b/src/components/atoms/analytics.tsx index bcd7815fd..4fdbcb537 100644 --- a/src/components/atoms/analytics.tsx +++ b/src/components/atoms/analytics.tsx @@ -2,5 +2,5 @@ import { AnalyticsBrowser } from '@segment/analytics-next'; // We can export this instance to share with rest of our codebase. export const analytics = AnalyticsBrowser.load({ - writeKey: 'oTuJ7Ab15OkcWQH1nAQKcKewzi9sQL3k', + writeKey: 'vkWzScRn3eSetN6cMhGhrzEuo4GaBJ0v', }); From 988004dd83281ed9618b6235effe27810a5dd962 Mon Sep 17 00:00:00 2001 From: Okeino McGowan Date: Tue, 26 Dec 2023 14:38:11 -0500 Subject: [PATCH 2/3] added tracking for high level menu link --- src/components/atoms/activeLink.tsx | 7 +++++++ src/components/molecules/navItem.tsx | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/atoms/activeLink.tsx b/src/components/atoms/activeLink.tsx index 4b2ab3e4c..bccbb9745 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; + linkLable?: string; }; // SOURCE: https://zaiste.net/programming/reactjs/howtos/create-activelink-nextjs/ @@ -15,6 +18,7 @@ const ActiveLink = ({ children, className, activeClassName, + linkLable, ...props }: ActiveLinkProps): JSX.Element => { const { asPath } = useRouter(); @@ -29,6 +33,9 @@ const ActiveLink = ({ { + analytics.track('menuClick', { lable: linkLable }); + }} > {children} diff --git a/src/components/molecules/navItem.tsx b/src/components/molecules/navItem.tsx index f58e096ea..ed42348d2 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} + linkLable={label} > {inner} ) : ( - setSubmenu(key)}> + { + analytics.track('menuClick', { link: label }), setSubmenu(key); + }} + > {inner} )} From 4673977d0468f2293315cdb5b6c57f7142178dc5 Mon Sep 17 00:00:00 2001 From: Okeino McGowan Date: Thu, 28 Dec 2023 08:28:08 -0500 Subject: [PATCH 3/3] updated to prod key --- src/components/atoms/analytics.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/atoms/analytics.tsx b/src/components/atoms/analytics.tsx index 4fdbcb537..bcd7815fd 100644 --- a/src/components/atoms/analytics.tsx +++ b/src/components/atoms/analytics.tsx @@ -2,5 +2,5 @@ import { AnalyticsBrowser } from '@segment/analytics-next'; // We can export this instance to share with rest of our codebase. export const analytics = AnalyticsBrowser.load({ - writeKey: 'vkWzScRn3eSetN6cMhGhrzEuo4GaBJ0v', + writeKey: 'oTuJ7Ab15OkcWQH1nAQKcKewzi9sQL3k', });