2022-02-18 16:59:56 +08:00
|
|
|
(function () {
|
2022-02-24 00:00:27 -09:00
|
|
|
var name = "qieziStatisticHtml";
|
|
|
|
var callback = name + "CallBack";
|
|
|
|
window[callback] = function (a) {
|
|
|
|
var hostPvNode = document.getElementById(name + "HostPv");
|
2022-02-28 15:53:55 +08:00
|
|
|
if (hostPvNode != null) {
|
2022-02-24 00:00:27 -09:00
|
|
|
document.getElementById(name + "HostPvValue").innerText = a.totalPv;
|
2022-02-28 15:53:55 +08:00
|
|
|
hostPvNode.style.display = "inline";
|
2022-02-24 00:00:27 -09:00
|
|
|
}
|
2022-02-18 16:59:56 +08:00
|
|
|
|
2022-02-24 00:00:27 -09:00
|
|
|
var hostUvNode = document.getElementById(name + "HostUv");
|
2022-02-28 15:53:55 +08:00
|
|
|
if (hostUvNode != null) {
|
|
|
|
document.getElementById(name + "HostUvValue").innerText = a.totalUv;
|
|
|
|
hostUvNode.style.display = "inline";
|
2022-02-24 00:00:27 -09:00
|
|
|
}
|
|
|
|
|
|
|
|
var postNode = document.getElementById(name + "Post");
|
|
|
|
if (postNode != null) {
|
|
|
|
document.getElementById(name + "PostPv").innerText = a.pagePv;
|
|
|
|
postNode.style.display = "inline";
|
|
|
|
}
|
|
|
|
};
|
2022-03-01 15:29:01 +08:00
|
|
|
var script = document.createElement("script");
|
|
|
|
script.type = "text/javascript";
|
|
|
|
script.defer = true;
|
|
|
|
var requestHost = "https://qiezi.fleyx.com";
|
2022-03-01 23:39:49 +08:00
|
|
|
if (window.qieziStatisticHost !== undefined && window.qieziStatisticHost.trim().length > 0) {
|
2022-03-01 15:29:01 +08:00
|
|
|
requestHost = window.qieziStatisticHost;
|
|
|
|
} else if (window.CONFIG && window.CONFIG.web_analytics.qieziStatistics.app_host) {
|
|
|
|
var temp = window.CONFIG.web_analytics.qieziStatistics.app_host;
|
|
|
|
if (temp.trim().length > 0) {
|
|
|
|
requestHost = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var key = null;
|
|
|
|
if (window.qieziStatisticKey && window.qieziStatisticKey.trim().length > 0) {
|
|
|
|
key = window.qieziStatisticKey;
|
|
|
|
} else if (window.CONFIG && window.CONFIG.web_analytics.qieziStatistics.app_key) {
|
|
|
|
var temp = window.CONFIG.web_analytics.qieziStatistics.app_key;
|
|
|
|
if (temp.trim().length > 0) {
|
|
|
|
key = temp;
|
|
|
|
}
|
|
|
|
}
|
2022-03-02 15:03:54 +08:00
|
|
|
var ignoreLocalhost = window.CONFIG !== undefined && window.CONFIG.web_analytics.qieziStatistics.ignore_local;
|
2022-03-01 15:29:01 +08:00
|
|
|
console.log(requestHost, key);
|
|
|
|
if (!key) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-02 15:03:54 +08:00
|
|
|
var notAdd = ignoreLocalhost && ['127.0.0.1', 'localhost'].indexOf(window.location.hostname) > -1;
|
|
|
|
script.src = `${requestHost}/qiezi/api/application/visit?callBack=${callback}&key=${key}&path=${encodeURIComponent(window.location.pathname)}¬Add=${notAdd}`;
|
2022-03-01 15:29:01 +08:00
|
|
|
document.getElementsByTagName("head")[0].appendChild(script);
|
2022-02-18 16:59:56 +08:00
|
|
|
})();
|