71 lines
2.6 KiB
Plaintext
71 lines
2.6 KiB
Plaintext
<% if (theme.web_analytics.enable) { %>
|
|
|
|
<% if(theme.web_analytics.baidu) { %>
|
|
<!-- Baidu Analytics -->
|
|
<script async>
|
|
if (!Fluid.ctx.dnt) {
|
|
var _hmt = _hmt || [];
|
|
(function() {
|
|
var hm = document.createElement("script");
|
|
hm.src = "https://hm.baidu.com/hm.js?<%= theme.web_analytics.baidu %>";
|
|
var s = document.getElementsByTagName("script")[0];
|
|
s.parentNode.insertBefore(hm, s);
|
|
})();
|
|
}
|
|
</script>
|
|
<% } %>
|
|
|
|
<% if (theme.web_analytics.google && theme.web_analytics.google.measurement_id){ %>
|
|
<!-- Google tag (gtag.js) -->
|
|
<script async>
|
|
if (!Fluid.ctx.dnt) {
|
|
Fluid.utils.createScript("https://www.googletagmanager.com/gtag/js?id=<%= theme.web_analytics.google.measurement_id %>", function() {
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag() {
|
|
dataLayer.push(arguments);
|
|
}
|
|
gtag('js', new Date());
|
|
gtag('config', '<%= theme.web_analytics.google.measurement_id %>');
|
|
});
|
|
}
|
|
</script>
|
|
<% } %>
|
|
|
|
<% if(theme.web_analytics.umami && theme.web_analytics.umami.src && theme.web_analytics.umami.website_id) { %>
|
|
<script async>
|
|
if (!Fluid.ctx.dnt) {
|
|
let umami = document.createElement('script');
|
|
umami.async = true;
|
|
umami.src = "<%= theme.web_analytics.umami.src %>";
|
|
umami.setAttribute("data-website-id", "<%= theme.web_analytics.umami.website_id %>");
|
|
umami.setAttribute("data-domains", "<%= theme.web_analytics.umami.domains %>");
|
|
document.head.appendChild(umami);
|
|
}
|
|
</script>
|
|
<% } %>
|
|
|
|
<% if(theme.web_analytics.tencent && theme.web_analytics.tencent.sid && theme.web_analytics.tencent.cid) { %>
|
|
<!-- Tencent Analytics -->
|
|
<script async>
|
|
if (!Fluid.ctx.dnt) {
|
|
var _mtac = {};
|
|
(function() {
|
|
var mta = document.createElement("script");
|
|
mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
|
|
mta.setAttribute("name", "MTAH5");
|
|
mta.setAttribute("sid", "<%= theme.web_analytics.tencent.sid %>");
|
|
<% if(theme.web_analytics.tencent.cid) { %>
|
|
mta.setAttribute("cid", "<%= theme.web_analytics.tencent.cid %>");
|
|
<% } %>
|
|
var s = document.getElementsByTagName("script")[0];
|
|
s.parentNode.insertBefore(mta, s);
|
|
})();
|
|
}
|
|
</script>
|
|
<% } %>
|
|
|
|
<% if(theme.web_analytics.leancloud && theme.web_analytics.leancloud.app_id && theme.web_analytics.leancloud.app_key) { %>
|
|
<% import_js(theme.static_prefix.internal_js, 'leancloud.js', 'defer') %>
|
|
<% } %>
|
|
<% } %>
|