Skip to content

Commit

Permalink
✨ 新增 Umami 访问统计插件
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeicanyue authored and zkqiang committed Jan 30, 2024
1 parent 341f576 commit 503ac14
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ web_analytics: # 网页访问统计
google:
measurement_id:

# Umami Analytics,src 和 data-website-id 是必填项,其他可选
# Umami Analytics, src and data-website-id are required, others are optional
umami:
# umami js 文件地址,需要在 umami 后台创建站点后获取
# umami js file url, get after create website in umami
src:
# umami 的 website id,需要在 umami 后台创建站点后获取
# umami website id, get after create website in umami
data_website_id:
# 如果你只想跟踪器跟踪特定的域名,你可以将它们添加到你的跟踪器脚本中。这是一个逗号分隔的域名列表。
# 如果你在一个分阶段、开发的环境中工作,这会很有帮助。避免统计 localhost。
# If you want the tracker to only run on specific domains, you can add them to your tracker script. This is a comma delimited list of domain names.
# Helps if you are working in a staging/development environment. Avoids tracking localhost.
data_domains:

# 腾讯统计的 H5 App ID,开启高级功能才有cid
# Tencent analytics, set APP ID
# See: https://mta.qq.com/h5/manage/ctr_app_manage
Expand Down
8 changes: 8 additions & 0 deletions layout/_partials/plugins/analytics.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
</script>
<% } %>
<% if(theme.web_analytics.umami && theme.web_analytics.umami.src && theme.web_analytics.umami.data_website_id) { %>
<!-- Umami Analytics -->
<script async defer src="<%= theme.web_analytics.umami.src %>" data-website-id="<%= theme.web_analytics.umami.data_website_id %>"
<% if (theme.web_analytics.umami.data_domains) { %> data-domains="<%= theme.web_analytics.umami.data_domains %>" <% } %>
<% if (theme.web_analytics.follow_dnt) { %> data-do-not-track="<%= theme.web_analytics.follow_dnt %>" <% } %>
></script>
<% } %>
<% if(theme.web_analytics.tencent && theme.web_analytics.tencent.sid && theme.web_analytics.tencent.cid) { %>
<!-- Tencent Analytics -->
<script async>
Expand Down

0 comments on commit 503ac14

Please sign in to comment.