feat: Add yandex metrika tracking code

This commit is contained in:
Dastan Abd 2021-12-06 20:25:32 +06:00
parent f787a4e5ad
commit 56d01049ba
2 changed files with 18 additions and 0 deletions

View file

@ -999,6 +999,8 @@ enableEmoji = true
# server url for your tracker if you're self hosting
# 自行托管追踪器时的主机路径
server = ""
[params.analytics.yandexMetrika]
id = ""
# Cookie consent config
# Cookie 许可配置

View file

@ -19,4 +19,20 @@
</script>
{{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}}
{{- end -}}
{{- /* Yandex Metrika */ -}}
{{- with $analytics.yandexMetrika.id -}}
<script type="text/javascript" >
(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();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({{ . }}, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/{{ . }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
{{- end -}}
{{- end -}}