https://github.com/gitbookio/plugin-ga
Google Analytics tracking for your book
https://github.com/gitbookio/plugin-ga
gitbook google-analytics
Last synced: 6 months ago
JSON representation
Google Analytics tracking for your book
- Host: GitHub
- URL: https://github.com/gitbookio/plugin-ga
- Owner: GitbookIO
- License: apache-2.0
- Created: 2014-04-22T09:49:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-02-18T22:30:07.000Z (almost 9 years ago)
- Last Synced: 2025-07-03T16:12:24.431Z (6 months ago)
- Topics: gitbook, google-analytics
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 52
- Watchers: 3
- Forks: 23
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Google Analytics tracking for GitBook
==============
You can use install it via **NPM**:
```
$ npm install gitbook-plugin-ga
```
And use it for your book with in the book.json:
```
{
"plugins": ["ga"]
}
```
You can set the Google Analytics tracking ID using the plugins configuration in the book.json:
```
{
"plugins": ["ga"],
"pluginsConfig": {
"ga": {
"token": "UA-XXXX-Y"
}
}
}
```
You can customize the tracker object by passing additional configuration options. You can either pass in `auto`, `none` or an object:
```
{
"plugins": ["ga"],
"pluginsConfig": {
"ga": {
"token": "UA-XXXX-Y",
"configuration": {
"cookieName": "new_cookie_name",
"cookieDomain": "mynew.domain.com"
}
}
}
}
```
For an overview of all available configuration parameters, please refer to the [analytics.js field reference](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#create).