@@ -7,18 +7,26 @@ import Col from 'react-bootstrap/Col';
77import Carousel from 'react-bootstrap/Carousel' ;
88import Card from 'react-bootstrap/Card' ;
99
10+ import ReactGA from "react-ga4" ;
11+
1012import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1113import { library } from '@fortawesome/fontawesome-svg-core'
1214import { fas } from '@fortawesome/free-solid-svg-icons'
1315import { fab } from '@fortawesome/free-brands-svg-icons'
1416
1517library . add ( fas , fab )
1618
17-
18-
1919const ProjectCarousel = ( { projects } ) => {
2020 const showcaseProjects = projects . filter ( p => p . isShowcase ) ;
2121
22+ const handleLinkClick = ( category , label , type ) => {
23+ ReactGA . event ( {
24+ category : category ,
25+ action : `Clicked ${ type } Link` ,
26+ label : label
27+ } ) ;
28+ } ;
29+
2230 const quickLinks = [
2331 { name : 'Qualcomm on GitHub' , url : 'https://github.com/Qualcomm' , icon : 'fa-brands fa-github' } ,
2432 { name : 'Qualcomm Developers' , url : 'https://www.qualcomm.com/developer' , icon : 'fa-solid fa-laptop-code' } ,
@@ -41,19 +49,19 @@ const ProjectCarousel = ({ projects }) => {
4149 < Card className = "shadow-sm pb-4" >
4250 < Card . Body >
4351 < Card . Title className = "mb-2" >
44- < Card . Link href = { project . link } target = "_blank" rel = "noopener noreferrer" className = "fw-bold text-decoration-none small" >
52+ < Card . Link href = { project . link } onClick = { ( ) => { handleLinkClick ( "Project" , project . name , "Project" ) ; } } target = "_blank" rel = "noopener noreferrer" className = "fw-bold text-decoration-none small" >
4553 { project . name } < FontAwesomeIcon icon = "fa-solid fa-arrow-up-right-from-square" className = "ms-2" />
4654 </ Card . Link >
4755 </ Card . Title >
4856 < Card . Subtitle className = "mb-2 text-muted small" >
4957 By:
50- < Card . Link href = { `https://github.com/${ project . author } ` } target = "_blank" rel = "noopener noreferrer" className = "text-decoration-none" >
58+ < Card . Link href = { `https://github.com/${ project . author } ` } onClick = { ( ) => { handleLinkClick ( "Project" , project . author , "Author" ) ; } } target = "_blank" rel = "noopener noreferrer" className = "text-decoration-none" >
5159 { project . author }
5260 </ Card . Link >
5361 </ Card . Subtitle >
5462 < Card . Text className = "small" > { project . description } </ Card . Text >
5563 < Card . Text >
56- < a href = { project . link } target = "_blank" rel = "noopener noreferrer" className = "card-link" >
64+ < a href = { project . link } onClick = { ( ) => { handleLinkClick ( "Project" , project . name , "Project" ) ; } } target = "_blank" rel = "noopener noreferrer" className = "card-link" >
5765 View Project
5866 </ a >
5967 </ Card . Text >
@@ -68,7 +76,7 @@ const ProjectCarousel = ({ projects }) => {
6876 < ul className = "list-unstyled" >
6977 { quickLinks . map ( link => (
7078 < li key = { link . name } >
71- < a href = { link . url } target = "_blank" rel = "noopener noreferrer" className = " text-decoration-none" >
79+ < a href = { link . url } onClick = { ( ) => { handleLinkClick ( "Quick Link" , link . name , "Quick" ) ; } } target = "_blank" rel = "noopener noreferrer" className = " text-decoration-none" >
7280 < FontAwesomeIcon icon = { link . icon } className = "ms-2" /> { link . name }
7381 </ a >
7482 </ li >
0 commit comments