added YandexMetrika
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Struchkov Mark 2024-09-05 22:18:41 +03:00
parent 41109cec4f
commit 4fbaa69a5a
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,29 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
// @ts-ignore
const YandexMetrika: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const embedScript = `
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(98254050, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
`
return (
<>
<script dangerouslySetInnerHTML={{ __html: embedScript }}></script>
<noscript>
<div><img src="https://mc.yandex.ru/watch/98254050" style="position:absolute; left:-9999px;" alt="" /></div>
</noscript>
</>
)
}
export default (() => YandexMetrika) satisfies QuartzComponentConstructor

View File

@ -25,6 +25,7 @@ import ScrollToTop from "./_ScrollToTop"
import GithubSource from "./_GithubSource"
import RandomPageButton from "./_RandomPageButton"
import Ads from "./_Ads"
import YandexMetrika from "./_YandexMetrika"
export {
ArticleTitle,
@ -53,5 +54,6 @@ export {
GithubSource,
ScrollToTop,
RandomPageButton,
Ads
Ads,
YandexMetrika
}