Add Yandex.Metrika counter

This commit is contained in:
Daniil Krymov 2023-01-20 21:04:35 +01:00
parent d3d90be8a4
commit 016fe9fdb3
No known key found for this signature in database
GPG Key ID: 49FF57C32BD36752
2 changed files with 17 additions and 0 deletions

View File

@ -164,6 +164,7 @@
{{- /* Misc */}}
{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
{{- template "_internal/google_analytics.html" . }}
{{- template "partials/templates/yandex_metrika.html" . }}
{{- template "partials/templates/opengraph.html" . }}
{{- template "partials/templates/twitter_cards.html" . }}
{{- template "partials/templates/schema_json.html" . }}

View File

@ -0,0 +1,16 @@
{{- if site.Params.yandexMetrika }}<!-- Yandex.Metrika counter -->
<script>
(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({{ site.Params.yandexMetrika }}, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/{{ site.Params.yandexMetrika }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->{{- end -}}