Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Umami Analytics configuration #1059

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,22 @@ 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:
# 在 web_analytics 处开启遵循访客浏览器"请勿追踪"的设置,如果开启则不统计其访问

# 腾讯统计的 H5 App ID,开启高级功能才有cid
# Tencent analytics, set APP ID
# See: https://mta.qq.com/h5/manage/ctr_app_manage
Expand Down
5 changes: 5 additions & 0 deletions layout/_partials/plugins/analytics.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
</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
Loading