Skip to content

Commit 89a6d37

Browse files
committed
ktl-3944 chore: add event tracking to choose-share tab clicks
1 parent 8af0e01 commit 89a6d37

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

blocks/multiplatform/choose-share/blocks/what/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import styles from './choose-share-what.module.css';
99

1010
import { useTabScroll } from '../../hooks/useTabScroll';
1111
import Link from 'next/link';
12+
import { trackEvent } from '../../../../../utils/event-logger';
1213

1314
const TABS_BLOCKS = [
1415
{
@@ -60,6 +61,14 @@ export function ChooseShareWhat({ className }: { className?: string }) {
6061

6162
const navigateToHash = useTabScroll(TABS_BLOCKS, 'choose-share-what-', setActiveIndex);
6263

64+
const handleTabClick = (e: MouseEvent, tabId: string) => {
65+
trackEvent({
66+
eventAction: 'kt_kmp_choose_what_to_share_click',
67+
eventLabel: tabId,
68+
});
69+
navigateToHash(e);
70+
};
71+
6372
return (
6473
<section className={cn(className, styles.wrap, 'ktl-layout', 'ktl-layout--center')} data-testid={'share-what-block'}>
6574
<h2 className={cn(styles.title, textCn('rs-h1'))} data-testid={'share-what-title'}>Choose what to share</h2>
@@ -78,7 +87,8 @@ export function ChooseShareWhat({ className }: { className?: string }) {
7887
id={`choose-share-what-${id}-tab`} role="tab"
7988
aria-controls={`choose-share-what-${id}-content`}
8089
href={`#choose-share-what-${id}`} aria-label={`Go to ${id} section`}
81-
onClick={navigateToHash} data-testid={'share-what-chip-anchor'}
90+
onClick={(e) => handleTabClick(e, id)}
91+
data-testid={'share-what-chip-anchor'}
8292
{...(activeIndex === i && { 'aria-selected': true })}
8393
>
8494
<Tab />

blocks/multiplatform/choose-share/blocks/where/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import styles from './choose-share-where.module.css';
99

1010
import { useTabScroll } from '../../hooks/useTabScroll';
1111
import Link from 'next/link';
12+
import { trackEvent } from '../../../../../utils/event-logger';
1213

1314

1415
const TABS_BLOCKS = [
@@ -91,6 +92,14 @@ export function ChooseShareWhere({ className }: { className?: string }) {
9192

9293
const navigateToHash = useTabScroll(TABS_BLOCKS, 'choose-share-where-', setActiveIndex);
9394

95+
const handleTabClick = (e: MouseEvent, tabId: string) => {
96+
trackEvent({
97+
eventAction: 'kt_kmp_choose_where_to_share_click',
98+
eventLabel: tabId
99+
});
100+
navigateToHash(e);
101+
};
102+
94103
return (
95104
<section className={cn(className, styles.wrap, 'ktl-layout', 'ktl-layout--center')}>
96105
<h2 className={cn(styles.title, textCn('rs-h2'))}>Choose where to share</h2>
@@ -110,7 +119,8 @@ export function ChooseShareWhere({ className }: { className?: string }) {
110119
id={`choose-share-where-${id}-tab`} role="tab"
111120
aria-controls={`choose-share-where-${id}-pane`}
112121
className={styles.tab} aria-label={`Go to ${id} section`}
113-
onClick={navigateToHash} {...(activeIndex === i && { 'aria-selected': true })}>
122+
onClick={(e) => handleTabClick(e, id)}
123+
{...(activeIndex === i && { 'aria-selected': true })}>
114124
{tab}
115125
</Chip>
116126
))}

0 commit comments

Comments
 (0)