Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
gitbook-plugin-baidu-tongji-with-multiple-channel
Advanced tools
Readme
Gitbook 百度统计插件,支持多渠道独立统计,一份源码多处部署独立统计.
用法
{
"plugins": [
"baidu-tongji-with-multiple-channel"
],
"pluginsConfig": {
"baidu-tongji-with-multiple-channel": {
"token": "5273b2f99de3bc190886abb53f62267e"
}
}
}
效果
<script src="https://hm.baidu.com/hm.js?5273b2f99de3bc190886abb53f62267e"></script>
book.json
文件在您的 gitbook
的 book.json
文件中,将 baidu-tongji-with-multiple-channel
添加到 plugins
列表中.
这是最简单的示例:
{
"plugins": ["baidu-tongji-with-multiple-channel"]
}
此外,受支持的配置选项如下:
"gitbook": {
"properties": {
"token": {
"description": "百度统计token",
"required": false,
"type": "string"
},
"url": {
"description": "百度统计地址",
"default":"https://hm.baidu.com/hm.js",
"required": false,
"type": "string"
},
"multipleChannelConfig": {
"description": "百度统计多渠道配置",
"required": false,
"type": "object"
}
}
}
gitbook
命令gitbook install
.它将自动为您的 gitbook
安装 baidu-tongji-with-multiple-channel
插件.该步骤仅需要允许一次即可.
gitbook install
或者您可以运行 npm install gitbook-plugin-baidu-tongji-with-multiple-channel
命令本地安装 gitbook-plugin-baidu-tongji-with-multiple-channel
插件.
npm install gitbook-plugin-baidu-tongji-with-multiple-channel
gitbook build
)或服务( gitbook serve
).gitbook serve
上传网站后访问网站首页检查是否自动注入百度统计脚本文件,也在百度统计后台检测是否配置成功.
<script src="https://hm.baidu.com/hm.js?5273b2f99de3bc190886abb53f62267e"></script>
登录百度统计官网,注册或者登录百度统计后台,点击新增网站并填写网站相关信息.
名称 | 示例 | 备注 |
---|---|---|
网站域名 | snowdreams1006.github.io | 支持主域名,二级域名,子目录和wap站域名 |
网站首页 | https://snowdreams1006.github.io/ | 必选 |
网站名称 | 雪之梦技术驿站 | 可选 |
行业类别 | 博客-教育 | 可选 |
新增网站成功后,点击代码获取,复制统计代码脚本如下:
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?5273b2f99de3bc190886abb53f62267e";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
名称 | 示例 | 备注 |
---|---|---|
源地址 | https://hm.baidu.com/hm.js?5273b2f99de3bc190886abb53f62267e | 统计脚本地址 |
url | https://hm.baidu.com/hm.js | 每个网站的值相同 |
token | 5273b2f99de3bc190886abb53f62267e | 每个网站的值不同 |
复制刚刚申请的 token
以及 url
填写到 book.json
配置文件中,按照实际情况填写百度统计配置信息.
token
的值即可,其余选项可选."baidu-tongji-with-multiple-channel": {
"token": "5273b2f99de3bc190886abb53f62267e"
}
token
的值,还需要填写百度统计 url
."baidu-tongji-with-multiple-channel": {
"url": "https://hm.baidu.com/hm.js",
"multipleChannelConfig": {
"snowdreams1006.tech":{
"token": "468a97b20b79bc025d27afbee73d2f39"
},
"blog.snowdreams1006.cn":{
"token": "606f5db455f771889dcfd16bb2bd313b"
},
"snowdreams1006.github.io":{
"token": "5273b2f99de3bc190886abb53f62267e"
},
"snowdreams1006.gitee.io":{
"token": "60ec676f32be4579eb53a430e153f677"
},
"snowdreams1006.gitlab.io":{
"token": "187a0e5601c4e4987cdb5b8df09c9b21"
},
"snowdreams1006.gitbook.io":{
"token": "6e2ee1b7bea146b2d6d9382bbf803083"
}
}
}
{
"plugins": ["baidu-tongji-with-multiple-channel"],
"pluginsConfig": {
"baidu-tongji-with-multiple-channel": {
"method": "baidu-tongji-with-multiple-channelJson"
}
}
}
{
"plugins": ["baidu-tongji-with-multiple-channel"],
"pluginsConfig": {
"baidu-tongji-with-multiple-channel": {
"method": "baidu-tongji-with-multiple-channelJson"
}
}
}
注意 :如果您的书还没有创建,以上代码段可以用作完整的 book.json
文件.
👤 snowdreams1006
欢迎贡献问题和功能需求,随时检查问题页面 .
如果这个项目对您有帮助,请给个星星 !
版权所有©2019 snowdreams1006.
该项目是MIT许可的.
FAQs
Gitbook 百度统计插件,支持多渠道独立统计,一份源码多处部署独立统计.
The npm package gitbook-plugin-baidu-tongji-with-multiple-channel receives a total of 5 weekly downloads. As such, gitbook-plugin-baidu-tongji-with-multiple-channel popularity was classified as not popular.
We found that gitbook-plugin-baidu-tongji-with-multiple-channel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.