-->
`
};
// 自动加载站点统计脚本【无需修改】
if (STATS_ENABLE) {
(function loadStats() {
const head = document.head || document.getElementsByTagName('head')[0];
switch (STATS_TYPE) {
case 'cnzz':
if (STATS_CONFIG.cnzz) {
const cnzzScript = document.createElement('script');
cnzzScript.src = `https://s9.cnzz.com/z_stat.php?id=${STATS_CONFIG.cnzz}&web_id=${STATS_CONFIG.cnzz}`;
cnzzScript.async = true;
head.appendChild(cnzzScript);
}
break;
case 'baidu':
if (STATS_CONFIG.baidu) {
const baiduScript = document.createElement('script');
baiduScript.src = `https://hm.baidu.com/hm.js?${STATS_CONFIG.baidu}`;
baiduScript.async = true;
head.appendChild(baiduScript);
}
break;
case 'google':
if (STATS_CONFIG.google) {
const googleScript1 = document.createElement('script');
googleScript1.src = `https://www.googletagmanager.com/gtag/js?id=${STATS_CONFIG.google}`;
googleScript1.async = true;
head.appendChild(googleScript1);
const googleScript2 = document.createElement('script');
googleScript2.textContent = `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${STATS_CONFIG.google}');
`;
head.appendChild(googleScript2);
}
break;
case 'custom':
if (STATS_CONFIG.custom) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = STATS_CONFIG.custom;
const scripts = tempDiv.getElementsByTagName('script');
for (let i = 0; i < scripts.length; i++) {
head.appendChild(scripts[i]);
}
}
break;
}
})();
}