Skip to content

Commit 0c8e7fc

Browse files
committed
fix(matomo): add locale to event category name
Break Homepage metrics into per-locale dashboards
1 parent f758828 commit 0c8e7fc

File tree

5 files changed

+36
-20
lines changed

5 files changed

+36
-20
lines changed

src/components/Homepage/BentoCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type BentoCardProps = HTMLAttributes<HTMLDivElement> & {
1818
imgHeight?: number
1919
title: string
2020
eventName: string
21+
eventCategory: string
2122
}
2223

2324
const BentoCard = ({
@@ -30,6 +31,7 @@ const BentoCard = ({
3031
imgHeight,
3132
title,
3233
eventName,
34+
eventCategory,
3335
}: BentoCardProps) => (
3436
<Card
3537
className={cn(
@@ -50,7 +52,7 @@ const BentoCard = ({
5052
variant="outline"
5153
isSecondary
5254
customEventOptions={{
53-
eventCategory: "Homepage",
55+
eventCategory,
5456
eventAction: "use cases",
5557
eventName,
5658
}}

src/components/Homepage/ValuesMarquee.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type ItemProps = React.HTMLAttributes<HTMLButtonElement> & {
2525
separatorClass: string
2626
container?: HTMLElement | null
2727
label: string
28+
eventCategory: string
2829
}
2930

3031
const Item = ({
@@ -34,13 +35,14 @@ const Item = ({
3435
separatorClass,
3536
container,
3637
label,
38+
eventCategory,
3739
}: ItemProps) => (
3840
<>
3941
<Tooltip
4042
container={container}
4143
onBeforeOpen={() => {
4244
trackCustomEvent({
43-
eventCategory: "Homepage",
45+
eventCategory,
4446
eventAction: "internet_changing",
4547
eventName: label,
4648
})
@@ -138,7 +140,7 @@ const Row = forwardRef<HTMLDivElement, RowProps>(
138140
Row.displayName = "Row"
139141

140142
const ValuesMarquee = () => {
141-
const { t, pairings } = useValuesMarquee()
143+
const { t, pairings, eventCategory } = useValuesMarquee()
142144
const containerFirstRef = useRef<HTMLDivElement>(null)
143145
const containerSecondRef = useRef<HTMLDivElement>(null)
144146

@@ -182,6 +184,7 @@ const ValuesMarquee = () => {
182184
pairing={pairing}
183185
separatorClass="bg-accent-a"
184186
className="group/item bg-blue-100 text-blue-600 hover:bg-blue-600 hover:text-white dark:hover:bg-blue-700"
187+
eventCategory={eventCategory}
185188
>
186189
<FaCheck className="me-1 text-success group-hover/item:text-white" />
187190
{pairing.ethereum.label}
@@ -202,6 +205,7 @@ const ValuesMarquee = () => {
202205
pairing={pairing}
203206
className="bg-gray-200/20 text-body-medium hover:bg-gray-600 hover:text-white dark:bg-gray-950 dark:text-body"
204207
separatorClass="bg-gray-200 dark:bg-gray-950"
208+
eventCategory={eventCategory}
205209
>
206210
{pairing.legacy.label}
207211
</Item>

src/components/Homepage/useHome.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const useHome = () => {
4040

4141
const { direction, isRtl } = useRtlFlip()
4242

43+
const eventCategory = `Homepage - ${locale}`
44+
4345
const toggleCodeExample = (id: number): void => {
4446
setActiveCode(id)
4547
setModalOpen(true)
@@ -222,5 +224,6 @@ export const useHome = () => {
222224
upcomingEvents,
223225
joinActions,
224226
bentoItems,
227+
eventCategory,
225228
}
226229
}

src/components/Homepage/useValuesMarquee.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useRouter } from "next/router"
12
import { useTranslation } from "next-i18next"
23

34
type Item = {
@@ -12,6 +13,7 @@ export type Pairing = {
1213

1314
export const useValuesMarquee = () => {
1415
const { t } = useTranslation("page-index")
16+
const { locale } = useRouter()
1517
const pairings: Pairing[] = [
1618
{
1719
legacy: {
@@ -94,5 +96,7 @@ export const useValuesMarquee = () => {
9496
},
9597
]
9698

97-
return { t, pairings }
99+
const eventCategory = `Homepage - ${locale}`
100+
101+
return { t, pairings, eventCategory }
98102
}

src/pages/index.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const HomePage = ({
198198
upcomingEvents,
199199
joinActions,
200200
bentoItems,
201+
eventCategory,
201202
} = useHome()
202203

203204
const { onCopy, hasCopied } = useClipboard()
@@ -225,7 +226,7 @@ const HomePage = ({
225226
href={href}
226227
label={label}
227228
customEventOptions={{
228-
eventCategory: "Homepage",
229+
eventCategory,
229230
eventAction: "Top 4 CTAs",
230231
eventName: subHeroCTAs[idx].eventName,
231232
}}
@@ -282,7 +283,7 @@ const HomePage = ({
282283
effect="cards"
283284
onSlideChange={({ activeIndex }) => {
284285
trackCustomEvent({
285-
eventCategory: "Homepage",
286+
eventCategory,
286287
eventAction: "mobile use cases",
287288
eventName: `swipe to card ${activeIndex + 1}`,
288289
})
@@ -295,6 +296,7 @@ const HomePage = ({
295296
{...item}
296297
className={cn(className, "bg-background text-body")}
297298
imgWidth={undefined} // Intentionally last to override box
299+
eventCategory={eventCategory}
298300
/>
299301
</SwiperSlide>
300302
))}
@@ -307,6 +309,7 @@ const HomePage = ({
307309
key={item.title}
308310
{...item}
309311
className={cn(className, "max-lg:hidden")} // Desktop only
312+
eventCategory={eventCategory}
310313
/>
311314
))}
312315
</Section>
@@ -368,7 +371,7 @@ const HomePage = ({
368371
className
369372
)}
370373
customEventOptions={{
371-
eventCategory: "Homepage",
374+
eventCategory,
372375
eventAction: "popular topics",
373376
eventName,
374377
}}
@@ -388,7 +391,7 @@ const HomePage = ({
388391
isSecondary
389392
className="max-sm:self-start"
390393
customEventOptions={{
391-
eventCategory: "Homepage",
394+
eventCategory,
392395
eventAction: "learn",
393396
eventName: "learn",
394397
}}
@@ -425,7 +428,7 @@ const HomePage = ({
425428
size="lg"
426429
className="w-fit"
427430
customEventOptions={{
428-
eventCategory: "Homepage",
431+
eventCategory,
429432
eventAction: "builders",
430433
eventName: "developers",
431434
}}
@@ -440,7 +443,7 @@ const HomePage = ({
440443
isSecondary
441444
className="w-fit"
442445
customEventOptions={{
443-
eventCategory: "Homepage",
446+
eventCategory,
444447
eventAction: "builders",
445448
eventName: "dev docs",
446449
}}
@@ -466,7 +469,7 @@ const HomePage = ({
466469
onClick={() => {
467470
toggleCodeExample(idx)
468471
trackCustomEvent({
469-
eventCategory: "Homepage",
472+
eventCategory,
470473
eventAction: "Code Examples",
471474
eventName,
472475
})
@@ -570,7 +573,7 @@ const HomePage = ({
570573
href="/community/"
571574
size="lg"
572575
customEventOptions={{
573-
eventCategory: "Homepage",
576+
eventCategory,
574577
eventAction: "community",
575578
eventName: "community",
576579
}}
@@ -585,7 +588,7 @@ const HomePage = ({
585588
isSecondary
586589
hideArrow
587590
customEventOptions={{
588-
eventCategory: "Homepage",
591+
eventCategory,
589592
eventAction: "community",
590593
eventName: "discord",
591594
}}
@@ -599,7 +602,7 @@ const HomePage = ({
599602
isSecondary
600603
hideArrow
601604
customEventOptions={{
602-
eventCategory: "Homepage",
605+
eventCategory,
603606
eventAction: "community",
604607
eventName: "github",
605608
}}
@@ -616,7 +619,7 @@ const HomePage = ({
616619
{calendar.length > 0 ? (
617620
calendar.map(({ date, title, calendarLink }) => {
618621
const customEventOptions = {
619-
eventCategory: "Homepage",
622+
eventCategory,
620623
eventAction: "Community Events Widget",
621624
eventName: "upcoming",
622625
}
@@ -694,7 +697,7 @@ const HomePage = ({
694697
<Card
695698
href={link}
696699
customEventOptions={{
697-
eventCategory: "Homepage",
700+
eventCategory,
698701
eventAction: "blogs_posts",
699702
eventName: source,
700703
}}
@@ -731,7 +734,7 @@ const HomePage = ({
731734
href={href}
732735
key={name}
733736
customEventOptions={{
734-
eventCategory: "Homepage",
737+
eventCategory,
735738
eventAction: "blogs_read_more",
736739
eventName: name!,
737740
}}
@@ -771,7 +774,7 @@ const HomePage = ({
771774
idx === 0 && "col-span-1 sm:col-span-2 md:col-span-1"
772775
)}
773776
customEventOptions={{
774-
eventCategory: "Homepage",
777+
eventCategory,
775778
eventAction: "posts",
776779
eventName: title,
777780
}}
@@ -816,7 +819,7 @@ const HomePage = ({
816819
href="/community/events/"
817820
size="lg"
818821
customEventOptions={{
819-
eventCategory: "Homepage",
822+
eventCategory,
820823
eventAction: "events",
821824
eventName: "community events",
822825
}}
@@ -851,7 +854,7 @@ const HomePage = ({
851854
className={cn("max-w-screen-sm", className)}
852855
variant="row"
853856
customEventOptions={{
854-
eventCategory: "Homepage",
857+
eventCategory,
855858
eventAction: "join",
856859
eventName,
857860
}}

0 commit comments

Comments
 (0)