@@ -11,6 +11,8 @@ type FeatureItem = {
11
11
Svg ?: React . ComponentType < React . ComponentProps < 'svg' > >
12
12
// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/no-unused-prop-types
13
13
src ?: any
14
+ // eslint-disable-next-line react/no-unused-prop-types
15
+ eventTitle ?: string
14
16
link : string
15
17
}
16
18
@@ -32,6 +34,7 @@ const SponsorList: FeatureItem[] = [
32
34
title : 'Frigade' ,
33
35
src : require ( '@site/static/img/sponsors/frigade.png' ) . default ,
34
36
link : 'https://frigade.com/?source=react-tooltip' ,
37
+ eventTitle : 'frigade' ,
35
38
} ,
36
39
]
37
40
@@ -48,16 +51,37 @@ function Feature({ title, Svg, link }: FeatureItem) {
48
51
}
49
52
50
53
export default function HomepageSponsored ( ) : JSX . Element {
54
+ const onClickFrigadeBannerEventHandler = ( title : string ) => {
55
+ if ( typeof window !== 'undefined' ) {
56
+ window . dataLayer = window . dataLayer || [ ]
57
+
58
+ window . dataLayer . push ( {
59
+ event : `click_${ title } _banner` ,
60
+ place : 'home' ,
61
+ } )
62
+ }
63
+
64
+ return true
65
+ }
66
+
51
67
return (
52
68
< section className = { styles . features } >
53
69
< div className = "container" >
54
70
< h3 className = { styles . sponsoredTitle } > Sponsored by</ h3 >
55
71
< div className = "row" >
56
- { SponsorList . map ( ( { link, title, src } , idx ) => (
72
+ { SponsorList . map ( ( { link, title, src, eventTitle } , idx ) => (
57
73
// eslint-disable-next-line react/no-array-index-key
58
74
< div key = { idx } className = { clsx ( 'col col--12' ) } >
59
75
< div className = "text--center" >
60
- < a href = { link } title = { title } target = "_blank" rel = "noreferrer" >
76
+ < a
77
+ href = { link }
78
+ title = { title }
79
+ target = "_blank"
80
+ rel = "noreferrer"
81
+ onClick = { ( ) => {
82
+ onClickFrigadeBannerEventHandler ( eventTitle )
83
+ } }
84
+ >
61
85
< img src = { src } alt = { title } width = { 480 } />
62
86
</ a >
63
87
</ div >
0 commit comments