-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,13 @@ categories: | |
date: 2024-12-23 00:00:00 | ||
--- | ||
|
||
> | ||
> 杜老师不蒜子统计平台运营至今,经过星辰童鞋版本迭代,增加了很多新功能。更为值得称赞的是,版本升级并没有 BREAKING CHANGE,新版本仍兼容旧版本的调用脚本。使用旧版本的小伙伴不升级脚本也可继续使用! | ||
<!-- more --> | ||
|
||
## 特别感谢 | ||
## 再次感谢 | ||
|
||
首先特别感谢星辰童鞋,杜老师自建的国内不蒜子统计平台使用的就是他的开源代码,并且在测试过程中,提供了大量的帮助。 | ||
再次特别感谢星辰童鞋,杜老师自建的国内不蒜子统计平台使用的就是他的开源代码,并且在测试过程中,提供了大量的帮助。 | ||
|
||
通过 Golang+Redis 实现模仿不蒜子统计功能;UV 通过 IP+UA 统计,PV 通过 Referer 区分。 | ||
|
||
|
@@ -35,7 +35,7 @@ analytics: | |
如果非 Volantis 主题: | ||
|
||
``` | ||
<script async src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
<script defer src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
本文总阅读量 <span id="busuanzi_page_pv"></span> 次 | ||
本文总访客量 <span id="busuanzi_page_uv"></span> 人 | ||
本站总访问量 <span id="busuanzi_site_pv"></span> 次 | ||
|
@@ -50,4 +50,40 @@ analytics: | |
|
||
改为 | ||
|
||
`script(async data-pjax src='//npm.onmicrosoft.cn/[email protected]/bsz.js')` | ||
`script(async data-pjax src='//npm.onmicrosoft.cn/[email protected]/bsz.js')` | ||
|
||
## 可选参数 | ||
|
||
在非 Volantis 主题使用方法基础上,可以添加如下参数: | ||
|
||
| 属性 | 默认阈值 | 释义 | | ||
| - | - | - | | ||
| data-api | http://127.0.0.1:8080/api | 不蒜子 API 地址 | | ||
| pjax | false | 是否监听 Pjax 的变化 | | ||
| data-prefix | busuanzi | 标签前缀 | | ||
|
||
## 使用示例 | ||
|
||
在一些启用了 Pjax 技术的网站, 可以在 js 标签中加入 Pjax 属性, 来实现当网站切换页面时自动更新页面计数的效果: | ||
|
||
``` | ||
<script defer pjax src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
``` | ||
|
||
可使用 `data-api` 属性, 指定后端 API 的接口: | ||
|
||
``` | ||
<script defer data-api="https://bsz.dusays.com:9001/api" src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
``` | ||
|
||
可使用 `data-style` 属性, 指定数据的显示样式。默认显示完整数据,`short` 显示短形式, 如 1024 显示为 1k;`comma` 以逗号分隔数据, 如 1024 显示为 1,024: | ||
|
||
``` | ||
<script defer data-style="short" src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
``` | ||
|
||
不同于原版本, 为了更加精简去除了 `value` 字符, 仍然可以通过指定 `data-prefix` 属性来进行兼容: | ||
|
||
``` | ||
<script defer data-prefix="busuanzi_value" src="https://npm.onmicrosoft.cn/[email protected]/bsz.js"></script> | ||
``` |