2025-2-26-fixed

This commit is contained in:
2025-02-26 09:16:07 +08:00
parent bf50b6c865
commit 4968d276dc
456 changed files with 27801 additions and 1 deletions

View File

@ -0,0 +1,11 @@
{%- if theme.baidu_analytics %}
<script{{ pjax }}>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?{{ theme.baidu_analytics }}";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
{%- endif %}

View File

@ -0,0 +1,31 @@
{%- if theme.google_analytics.tracking_id %}
{%- if not theme.google_analytics.only_pageview %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme.google_analytics.tracking_id }}"></script>
<script{{ pjax }}>
if (CONFIG.hostname === location.hostname) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ theme.google_analytics.tracking_id }}');
}
</script>
{%- endif %}
{%- if theme.google_analytics.only_pageview %}
<script>
function sendPageView() {
if (CONFIG.hostname !== location.hostname) return;
var uid = localStorage.getItem('uid') || (Math.random() + '.' + Math.random());
localStorage.setItem('uid', uid);
navigator.sendBeacon('https://www.google-analytics.com/collect', new URLSearchParams({
v : 1,
tid: '{{ theme.google_analytics.tracking_id }}',
cid: uid,
t : 'pageview',
dp : encodeURIComponent(location.pathname)
}));
}
document.addEventListener('pjax:complete', sendPageView);
sendPageView();
</script>
{%- endif %}
{%- endif %}

View File

@ -0,0 +1,7 @@
{%- if theme.growingio_analytics %}
<script{{ pjax }}>
!function(e,t,n,g,i){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},n=t.createElement("script"),tag=t.getElementsByTagName("script")[0],n.async=1,n.src=('https:'==document.location.protocol?'https://':'http://')+g,tag.parentNode.insertBefore(n,tag)}(window,document,"script","assets.growingio.com/2.1/gio.js","gio");
gio('init', '{{ theme.growingio_analytics }}', {});
gio('send');
</script>
{%- endif %}

View File

@ -0,0 +1,3 @@
{% include 'google-analytics.swig' %}
{% include 'baidu-analytics.swig' %}
{% include 'growingio.swig' %}