diff options
author | Phillip Johnsen <johphi@gmail.com> | 2017-01-25 21:54:34 +0100 |
---|---|---|
committer | Phillip Johnsen <johphi@gmail.com> | 2017-01-25 21:54:34 +0100 |
commit | 01b90ee1db9276d6c1af0e6e0352fd4759ebb68d (patch) | |
tree | 4cc05f5854b0b9f1ff4c4b4c84ccddf8eb5e1b66 /tools/doc/generate.js | |
parent | 124d155f5ec22568c740d4a465f4496cda44deb6 (diff) | |
download | android-node-v8-01b90ee1db9276d6c1af0e6e0352fd4759ebb68d.tar.gz android-node-v8-01b90ee1db9276d6c1af0e6e0352fd4759ebb68d.tar.bz2 android-node-v8-01b90ee1db9276d6c1af0e6e0352fd4759ebb68d.zip |
tools,doc: add Google Analytics tracking.
Adds Google Analytics tracking script to all doc pages when
`DOCS_ANALYTICS` is set when running `make`:
```bash
$ DOCS_ANALYTICS=<GOOGLE ANALYTICS ID> make
```
By default (when `DOCS_ANALYTICS` is not set), no tracking scripts are
included.
It respects "Do Not Track" settings end users might have in their
browser.
Also changes make target `doc-upload` from depending on the
`$(TARBALL)` target, to only depend on `doc` directly.
PR-URL: https://github.com/nodejs/node/pull/6601
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/doc/generate.js')
-rw-r--r-- | tools/doc/generate.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 31b23c52a0..b7fcf0d4f9 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -11,16 +11,19 @@ let format = 'json'; let template = null; let inputFile = null; let nodeVersion = null; +let analytics = null; args.forEach(function(arg) { - if (!arg.match(/^--/)) { + if (!arg.startsWith('--')) { inputFile = arg; - } else if (arg.match(/^--format=/)) { + } else if (arg.startsWith('--format=')) { format = arg.replace(/^--format=/, ''); - } else if (arg.match(/^--template=/)) { + } else if (arg.startsWith('--template=')) { template = arg.replace(/^--template=/, ''); - } else if (arg.match(/^--node-version=/)) { + } else if (arg.startsWith('--node-version=')) { nodeVersion = arg.replace(/^--node-version=/, ''); + } else if (arg.startsWith('--analytics=')) { + analytics = arg.replace(/^--analytics=/, ''); } }); @@ -54,6 +57,7 @@ function next(er, input) { filename: inputFile, template: template, nodeVersion: nodeVersion, + analytics: analytics, }, function(er, html) { |