Docs: add google analytics, baidu and clarity (#1629)

Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
This commit is contained in:
Carson Yang
2024-05-29 14:44:26 +08:00
committed by GitHub
parent 1db816150b
commit ced23e1695
5 changed files with 68 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
<!-- Microsoft Clarity -->
<script defer>
function loadClarityScript() {
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "mjgug8s1pf");
window.removeEventListener('scroll', onScrollLoadClarity);
}
function onScrollLoadClarity() {
if (window.scrollY > 100) {
loadClarityScript();
}
}
window.addEventListener('scroll', onScrollLoadClarity);
</script>