Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handleClick(event: { target: any }) {
const url = event.target.href;
// We check for the type here as SVGs have a href type of `SVGAnimatedString`
if (typeof url === 'string' && isExternal(url)) {
ReactGA.outboundLink(
{
category: 'outbound',
action: 'click',
label: url,
},
() => {} // ReactGA requires the hitCallback arg
);
}
}
outboundLink: (args, hitCallback) => {
const { label } = { ...args };
GoogleAnalytics.outboundLink({ label }, hitCallback);
},
exception: (args) => {
export const trackExternalLink = url => {
if (url) ReactGA.outboundLink({ label: url }, () => {});
};
return () => {
ReactGA.outboundLink({
label: 'Login intent',
to: lastfmAuthURL
}, () => {
window.location = lastfmAuthURL;
});
};
}
export const logOutboundLink = (label) => {
ga.outboundLink({
label: label,
}, () => {});
};
export function trackAndOpenLink(from: string) {
if (EnvChecker.isProdBrowser()) {
ReactGA.outboundLink(
{
label: from,
},
() => {}
);
}
}