mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-15 09:35:21 +01:00
fixes
This commit is contained in:
parent
4ac25229a5
commit
a3f561264a
@ -2,26 +2,16 @@ import React from 'react'
|
||||
import styles from './Ad.module.scss'
|
||||
import { useSiteMetadata } from '../../hooks/use-site-metadata'
|
||||
|
||||
interface WindowWithMatomo extends Window {
|
||||
_paq?: any
|
||||
}
|
||||
|
||||
export default function Ad() {
|
||||
const { ad } = useSiteMetadata()
|
||||
|
||||
function handleClick(e: React.MouseEvent) {
|
||||
e.preventDefault()
|
||||
const { _paq } = window as WindowWithMatomo
|
||||
_paq && _paq.push(['trackEvent', 'Ad Interaction', 'click'])
|
||||
|
||||
window.open(ad.link)
|
||||
}
|
||||
|
||||
return (
|
||||
<a
|
||||
className={styles.ad}
|
||||
href={ad.link}
|
||||
onClick={(e: React.MouseEvent) => handleClick(e)}
|
||||
data-track-content
|
||||
data-content-name="Text Ad"
|
||||
data-content-piece={ad.title}
|
||||
>
|
||||
{ad.title}
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user