New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gitbook-plugin-ga

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitbook-plugin-ga - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

10

book/plugin.js

@@ -1,12 +0,4 @@

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
require(["gitbook"], function(gitbook) {
gitbook.events.bind("start", function(e, config) {
config.ga = config.ga || {};
ga('create', config.ga.token, 'auto');
ga('send', 'pageview');
});

@@ -19,4 +11,4 @@

gitbook.events.bind("exercise.submit", function(e, data) {
});
});

15

index.js

@@ -6,4 +6,17 @@ module.exports = {

"plugin.js"
]
],
html: {
"body:end": function() {
var config = this.options.pluginsConfig.ga || {};
if (!config.token) throw "Need to option 'token' for Google Analytics plugin";
return "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){"
+ "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),"
+ "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)"
+ "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');"
+ "ga('create', '"+config.token+"', 'auto');"
+ "ga('send', 'pageview');</script>";
}
}
}
};

@@ -5,5 +5,5 @@ {

"main": "index.js",
"version": "0.0.1",
"version": "0.1.0",
"engines": {
"gitbook": "*"
"gitbook": ">=0.4.6"
},

@@ -13,8 +13,8 @@ "homepage": "https://github.com/GitbookIO/plugin-ga",

"type": "git",
"url": "https://github.com/GitbookIO/plugin-mixpanel.git"
"url": "https://github.com/GitbookIO/plugin-ga.git"
},
"license": "Apache 2",
"bugs": {
"url": "https://github.com/GitbookIO/plugin-mixpanel/issues"
"url": "https://github.com/GitbookIO/plugin-ga/issues"
}
}
Google Analytics tracking for GitBook
==============
You can set the Google Analytics token using the plugins configuration (command line option: `--pluginsConfig`) with the following content:
You can use install it via **NPM**:
```
$ npm install gitbook-plugin-ga
```
And use it for your book with in the book.json:
```
{
"ga": {
"token": "UA-XXXX-Y"
"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"
}
}
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc