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-google-tongji-with-multiple-channel
Advanced tools
Readme
GitBook plugin that use Google Analytics to analyze website traffic, support for independent analysis of multiple channels, a source code deployed in multiple independent analysis.
Usage
{
"plugins": [
"google-tongji-with-multiple-channel"
],
"pluginsConfig": {
"google-tongji-with-multiple-channel": {
"token": "UA-140787039-1"
}
}
}
Result
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140787039-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140787039-1');
</script>
book.json
fileIn you gitbook's book.json
file, add google-tongji-with-multiple-channel
to plugins
list.
Here is simplest example :
{
"plugins": [
"google-tongji-with-multiple-channel"
],
"pluginsConfig": {
"google-tongji-with-multiple-channel": {
"token": "UA-XXXX-Y"
}
}
}
In addition, the supported configuration options are as follows :
"gitbook": {
"properties": {
"token": {
"description": "Google Analytics token",
"required": false,
"type": "string"
},
"url": {
"description": "Google Analytics Url",
"default": "https://www.googletagmanager.com/gtag/js",
"required": false,
"type": "string"
},
"multipleChannelConfig": {
"description": "Google Analytics Multi-channel Configuration",
"required": false,
"type": "object"
}
}
}
gitbook install
. It will automatically install google-tongji-with-multiple-channel
gitbook plugin for your book. This is needed only once.gitbook install
or you can run npm install gitbook-plugin-google-tongji-with-multiple-channel
to install locally.
npm install gitbook-plugin-google-tongji-with-multiple-channel
gitbook build
) or serve (gitbook serve
) as usual.gitbook serve
After uploading to the website, visit the homepage of the website to check whether the Google analysis script file is automatically injected.
You can also check whether the configuration is successfully configured in the Google analysis background.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140787039-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140787039-1');
</script>
Visit the Google analysis website, register or log in the Google analysis account, click create media resources and fill in the relevant information of the website.
name | demo | remark |
---|---|---|
name | github | required |
website | https://snowdreams1006.github.io/ | required |
categories | other | required |
timezone | GMT+08:00 | optional |
After adding media resources successfully, click next to get the integration code script as follows:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-140787039-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140787039-1');
</script>
name | demo | remark |
---|---|---|
Source address | https://www.googletagmanager.com/gtag/js?id=UA-140787039-1 | async |
url | https://www.googletagmanager.com/gtag/js | Each site has the same value |
token | UA-140787039-1 | Each site has a google-tongji-with-multiple-channelerent value |
Copy the token and url just applied and fill in the book.json configuration file, and fill in the Google analysis configuration information according to the actual situation.
token
, the rest of the options are optional."google-tongji-with-multiple-channel": {
"token": "UA-140787039-1"
}
token
corresponding to the website domain name, multiple channels also need to fill in the Google analysis url
"google-tongji-with-multiple-channel": {
"url": "https://www.googletagmanager.com/gtag/js",
"multipleChannelConfig": {
"snowdreams1006.gitbook.io":{
"token": "UA-140787039-1"
},
"snowdreams1006.github.io":{
"token": "UA-140787039-2"
},
"snowdreams1006.gitee.io":{
"token": "UA-140787039-3"
},
"snowdreams1006.gitlab.io":{
"token": "UA-140787039-4"
},
"snowdreams1006.tech":{
"token": "UA-140787039-5"
},
"blog.snowdreams1006.cn":{
"token": "UA-140787039-6"
}
}
}
{
"plugins": ["google-tongji-with-multiple-channel"],
"pluginsConfig": {
"google-tongji-with-multiple-channel": {
"multipleChannelConfig": {
"snowdreams1006.gitbook.io":{
"token": "UA-140787039-1"
},
"snowdreams1006.github.io":{
"token": "UA-140787039-2"
},
"snowdreams1006.gitee.io":{
"token": "UA-140787039-3"
},
"snowdreams1006.gitlab.io":{
"token": "UA-140787039-4"
},
"snowdreams1006.tech":{
"token": "UA-140787039-5"
},
"blog.snowdreams1006.cn":{
"token": "UA-140787039-6"
}
}
}
}
}
{
"plugins": ["google-tongji-with-multiple-channel"],
"pluginsConfig": {
"google-tongji-with-multiple-channel": {
"token": "UA-140787039-1"
}
}
}
Note: Above snippet can be used as complete book.json
file, if your book doesn't have one yet.
👤 snowdreams1006
Contributions, issues and feature requests are welcome! Feel free to check issues page.
Give a Star if this project helped you!
Copyright © 2019 snowdreams1006.
This project is MIT licensed.
FAQs
GitBook plugin that use Google Analytics to analyze website traffic, support for independent analysis of multiple channels, a source code deployed in multiple independent analysis.
The npm package gitbook-plugin-google-tongji-with-multiple-channel receives a total of 3 weekly downloads. As such, gitbook-plugin-google-tongji-with-multiple-channel popularity was classified as not popular.
We found that gitbook-plugin-google-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.