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} )