@@ -11,6 +11,8 @@ type FeatureItem = {
1111 Svg ?: React . ComponentType < React . ComponentProps < 'svg' > >
1212 // eslint-disable-next-line @typescript-eslint/no-explicit-any, react/no-unused-prop-types
1313 src ?: any
14+ // eslint-disable-next-line react/no-unused-prop-types
15+ eventTitle ?: string
1416 link : string
1517}
1618
@@ -32,6 +34,7 @@ const SponsorList: FeatureItem[] = [
3234 title : 'Frigade' ,
3335 src : require ( '@site/static/img/sponsors/frigade.png' ) . default ,
3436 link : 'https://frigade.com/?source=react-tooltip' ,
37+ eventTitle : 'frigade' ,
3538 } ,
3639]
3740
@@ -48,16 +51,37 @@ function Feature({ title, Svg, link }: FeatureItem) {
4851}
4952
5053export 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+
5167 return (
5268 < section className = { styles . features } >
5369 < div className = "container" >
5470 < h3 className = { styles . sponsoredTitle } > Sponsored by</ h3 >
5571 < div className = "row" >
56- { SponsorList . map ( ( { link, title, src } , idx ) => (
72+ { SponsorList . map ( ( { link, title, src, eventTitle } , idx ) => (
5773 // eslint-disable-next-line react/no-array-index-key
5874 < div key = { idx } className = { clsx ( 'col col--12' ) } >
5975 < 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+ >
6185 < img src = { src } alt = { title } width = { 480 } />
6286 </ a >
6387 </ div >
0 commit comments