Skip to content

Commit 58b235c

Browse files
mobeicanyuezkqiang
authored andcommitted
add comment and remove debug console.log
1 parent 861c2ca commit 58b235c

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ web_analytics: # 网页访问统计
260260
google:
261261
measurement_id:
262262

263-
# Umami Analyticssrc 和 data-website-id 是必填项,其他可选
264-
# Umami Analytics, src and data-website-id are required, others are optional
263+
# Umami Analytics 仅支持自部署。src 和 data-website-id 是必填项,其他可选
264+
# Umami Analytics, only Self-host support, src and data-website-id are required, others are optional
265265
umami:
266266
# umami js 文件地址,需要在 umami 后台创建站点后获取
267267
# umami js file url, get after create website in umami

source/js/umami-view.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const request_header = {
3838
},
3939
};
4040

41+
// 获取站点统计数据
4142
async function siteStats() {
4243
try {
4344
const response = await fetch(`${request_url}?${params}`, request_header);
@@ -68,14 +69,13 @@ async function siteStats() {
6869
}
6970
}
7071

72+
// 获取页面浏览量
7173
async function pageStats(path) {
7274
try {
7375
const response = await fetch(`${request_url}?${params}&url=${path}`, request_header);
7476
const data = await response.json();
7577
const pageViews = data.pageviews.value;
7678

77-
console.log(data)
78-
7979
let viewCtn = document.querySelector("#umami-page-views-container");
8080
if (viewCtn) {
8181
let ele = document.querySelector("#umami-page-views");
@@ -92,7 +92,9 @@ async function pageStats(path) {
9292

9393
siteStats();
9494

95+
// 获取页面容器
9596
let viewCtn = document.querySelector("#umami-page-views-container");
97+
// 如果页面容器存在,则获取页面浏览量
9698
if (viewCtn) {
9799
let path = window.location.pathname;
98100
let target = decodeURI(path.replace(/\/*(index.html)?$/, "/"));

0 commit comments

Comments
 (0)