mirror of
https://github.com/kremalicious/blog.git
synced 2024-12-22 17:23:50 +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 styles from './Ad.module.scss'
|
||||||
import { useSiteMetadata } from '../../hooks/use-site-metadata'
|
import { useSiteMetadata } from '../../hooks/use-site-metadata'
|
||||||
|
|
||||||
interface WindowWithMatomo extends Window {
|
|
||||||
_paq?: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Ad() {
|
export default function Ad() {
|
||||||
const { ad } = useSiteMetadata()
|
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 (
|
return (
|
||||||
<a
|
<a
|
||||||
className={styles.ad}
|
className={styles.ad}
|
||||||
href={ad.link}
|
href={ad.link}
|
||||||
onClick={(e: React.MouseEvent) => handleClick(e)}
|
data-track-content
|
||||||
|
data-content-name="Text Ad"
|
||||||
|
data-content-piece={ad.title}
|
||||||
>
|
>
|
||||||
{ad.title}
|
{ad.title}
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user