@@ -15,6 +15,7 @@ import AchievementModal from '../components/achievements/modals/AchievementModal
1515import NextStepModal from '../components/achievements/modals/NextStepModal' ;
1616import { NextStepLabelType } from '../helper/important-information-helper' ;
1717import { createPupilScreeningLink , createStudentScreeningLink } from '../helper/screening-helper' ;
18+ import { useMatomo } from '@jonkoops/matomo-tracker-react' ;
1819
1920type Props = {
2021 variant ?: 'normal' | 'dark' ;
@@ -28,6 +29,8 @@ type Information = {
2829 key ?: string ;
2930} ;
3031
32+ type ConfigurableInfo = { title : string ; desciption : string ; language : string ; btnfn : ( ( ) => void ) | null } ;
33+
3134export const IMPORTANT_INFORMATION_QUERY = gql ( `
3235query GetOnboardingInfos {
3336 important_informations {
@@ -123,6 +126,7 @@ query GetOnboardingInfos {
123126
124127const ImportantInformation : React . FC < Props > = ( { variant } ) => {
125128 const { t, i18n } = useTranslation ( ) ;
129+ const { trackEvent } = useMatomo ( ) ;
126130 const navigate = useNavigate ( ) ;
127131
128132 const { show } = useModal ( ) ;
@@ -317,7 +321,7 @@ const ImportantInformation: React.FC<Props> = ({ variant }) => {
317321 } , [ student , sendMail , email , pupil , roles , confirmInterest , refuseInterest , deleteMatchRequest , data , navigate ] ) ;
318322
319323 const configurableInfos = useMemo ( ( ) => {
320- let configurableInfos : { title : string ; desciption : string ; btnfn : ( ( ) => void ) | null } [ ] = [ ] ;
324+ let configurableInfos : ConfigurableInfo [ ] = [ ] ;
321325
322326 // -------- Configurable Important Information -----------
323327 importantInformations
@@ -335,13 +339,32 @@ const ImportantInformation: React.FC<Props> = ({ variant }) => {
335339 window . location . href = info . navigateTo ;
336340 }
337341 : null ,
342+ language : info . language ,
338343 } ) ;
339344 } ) ;
340345 return configurableInfos ;
341346 } , [ importantInformations , pupil , student ] ) ;
342347
343348 if ( ! infos . length && ! configurableInfos . length ) return null ;
344349
350+ const handleOnConfigurableInfoClick = ( info : ConfigurableInfo ) => {
351+ trackEvent ( {
352+ category : 'dashboard' ,
353+ action : 'Click Important Information Card' ,
354+ name : `${ pupil ? 'SuS' : 'HuH' } - ${ info . title } - ${ info . language } ` ,
355+ } ) ;
356+ info . btnfn && info . btnfn ( ) ;
357+ } ;
358+
359+ const handleOnInfoClick = ( info : Information ) => {
360+ trackEvent ( {
361+ category : 'dashboard' ,
362+ action : 'Click Important Information Card' ,
363+ name : `${ pupil ? 'SuS' : 'HuH' } - ${ t ( `helperwizard.${ info . label } .title` as unknown as TemplateStringsArray , { lng : 'de' } ) } ` ,
364+ } ) ;
365+ setSelectedInformation ( info ) ;
366+ } ;
367+
345368 return (
346369 < Box >
347370 { selectedAchievement && (
@@ -400,7 +423,7 @@ const ImportantInformation: React.FC<Props> = ({ variant }) => {
400423 actionDescription = { t ( 'moreInfoButton' ) }
401424 actionType = { Achievement_Action_Type_Enum . Action }
402425 onClick = { ( ) => {
403- info . btnfn && info . btnfn ( ) ;
426+ handleOnConfigurableInfoClick ( info ) ;
404427 } }
405428 />
406429 ) ;
@@ -419,7 +442,7 @@ const ImportantInformation: React.FC<Props> = ({ variant }) => {
419442 description = { t ( `helperwizard.${ config . label } .content` as unknown as TemplateStringsArray , config . lang ) }
420443 actionDescription = { actionDescription }
421444 actionType = { Achievement_Action_Type_Enum . Action }
422- onClick = { ( ) => setSelectedInformation ( { ...config , btntxt : buttontexts } ) }
445+ onClick = { ( ) => handleOnInfoClick ( { ...config , btntxt : buttontexts } ) }
423446 />
424447 ) ;
425448 } ) }
0 commit comments