ReactGA.OutboundLink() Not Working
aress31 opened this issue · comments
Alexandre Teyar commented
I am attempting to track social media clicks as follows:
{socialMedias.map((item) => (
<IconButton
aria-label={item.ariaLabel}
color='inherit'
component='a'
href={item.href}
key={uid(item)}
onClick={() =>
ReactGA.outboundLink({
label: item.ariaLabel,
})
}
rel='noopener'
size='small'
target='_blank'
>
<item.icon />
</IconButton>
))}
But no event is emitted at all is this normal? 🤔
Edit: It probably got to do with the fact that I am calling initalize in App.js
and just calling the different method in other files, probably need a context to use only instance accross my entire app. Would you mind providing such example?
Alexandre Teyar commented
Solved my issue, the problem was that I didn't pass an object... Still my comment about the built in context for application wide use might be useful!