From 4ec6dafb9e84768198168016a6291744c07e1028 Mon Sep 17 00:00:00 2001 From: thomasrosen Date: Wed, 21 Apr 2021 01:36:11 +0200 Subject: [PATCH] added logging to the footer links --- src/App.js | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/src/App.js b/src/App.js index df45bd8..ae474f6 100644 --- a/src/App.js +++ b/src/App.js @@ -71,6 +71,36 @@ function trigger_download(name, data){ a.remove() } +function UmamiLink({ href, name, target, children, ...props }) { + const handleClick = useCallback(event => { + + if (name) { + window.umami.trackEvent('A: ' + name) // Log Anker / Link + } + + // follow link + if (!(!!target)) { + setTimeout(() => { + window.location = href + }, 200) + }else{ + window.open(href, target) + } + + // Prevent normal href-follow + event.preventDefault() + return false + }, [href, name]) + + return + {children} + +} + function App({ getString }) { const [frame, setFrame] = useState(null) const [hashtag, setHashtag] = useState(null) @@ -337,21 +367,21 @@ function App({ getString }) { ) : null} )