GeezerVison is showing github.com — doc: remove GA tracking · nodejs/node@003d85d
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Makefile +1-7Lines changed: 1 addition & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -597,11 +597,6 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all: | 597 | 597 | "$ git clone https://github.com/nodejs/node.git" | 598 | 598 | endif | 599 | 599 |
| 600 | | -# Google Analytics ID used for tracking API docs page views, empty | 601 | | -# DOCS_ANALYTICS means no tracking scripts will be included in the | 602 | | -# generated .html files | 603 | | -DOCS_ANALYTICS ?= | 604 | | - | 605 | 600 | apidoc_dirs = out/doc out/doc/api out/doc/api/assets | 606 | 601 | apidoc_sources = $(wildcard doc/api/*.md) | 607 | 602 | apidocs_html = $(addprefix out/,$(apidoc_sources:.md=.html)) | @@ -646,8 +641,7 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets | 646 | 641 | run-npm-ci = $(PWD)/$(NPM) ci | 647 | 642 |
| 648 | 643 | gen-api = tools/doc/generate.js --node-version=$(FULLVERSION) \ | 649 | | - --apilinks=out/apilinks.json \ | 650 | | - --analytics=$(DOCS_ANALYTICS) $< --output-directory=out/doc/api | | 644 | + --apilinks=out/apilinks.json $< --output-directory=out/doc/api | 651 | 645 | gen-apilink = tools/doc/apilinks.js $(wildcard lib/*.js) > $@ | 652 | 646 |
| 653 | 647 | out/apilinks.json: $(wildcard lib/*.js) tools/doc/apilinks.js | |
Collapse file Copy file name to clipboardExpand all lines: doc/template.html -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,6 +54,5 @@ <h2>Table of Contents</h2> | 54 | 54 | <script src="assets/sh_main.js"></script> | 55 | 55 | <script src="assets/sh_javascript.min.js"></script> | 56 | 56 | <script>highlight(undefined, undefined, 'pre');</script> | 57 | | - <!-- __TRACKING__ --> | 58 | 57 | </body> | 59 | 58 | </html> |
Collapse file Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.js +3-18Lines changed: 3 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,7 @@ const remark2rehype = require('remark-rehype'); | 22 | 22 | const raw = require('rehype-raw'); | 23 | 23 | const htmlStringify = require('rehype-stringify'); | 24 | 24 |
| 25 | | -function toHTML({ input, filename, nodeVersion, analytics }, cb) { | | 25 | +function toHTML({ input, filename, nodeVersion }, cb) { | 26 | 26 | const content = unified() | 27 | 27 | .use(markdown) | 28 | 28 | .use(html.firstHeader) | @@ -35,7 +35,7 @@ function toHTML({ input, filename, nodeVersion, analytics }, cb) { | 35 | 35 | .processSync(input); | 36 | 36 |
| 37 | 37 | html.toHTML( | 38 | | - { input, content, filename, nodeVersion, analytics }, | | 38 | + { input, content, filename, nodeVersion }, | 39 | 39 | cb | 40 | 40 | ); | 41 | 41 | } | @@ -94,16 +94,14 @@ const testData = [ | 94 | 94 | file: fixtures.path('sample_document.md'), | 95 | 95 | html: '<ol><li>fish</li><li>fish</li></ol>' + | 96 | 96 | '<ul><li>Red fish</li><li>Blue fish</li></ul>', | 97 | | - analyticsId: 'UA-67020396-1' | 98 | 97 | }, | 99 | 98 | ]; | 100 | 99 |
| 101 | 100 | const spaces = /\s/g; | 102 | 101 |
| 103 | | -testData.forEach(({ file, html, analyticsId }) => { | | 102 | +testData.forEach(({ file, html }) => { | 104 | 103 | // Normalize expected data by stripping whitespace. | 105 | 104 | const expected = html.replace(spaces, ''); | 106 | | - const includeAnalytics = typeof analyticsId !== 'undefined'; | 107 | 105 |
| 108 | 106 | readFile(file, 'utf8', common.mustCall((err, input) => { | 109 | 107 | assert.ifError(err); | @@ -112,7 +110,6 @@ testData.forEach(({ file, html, analyticsId }) => { | 112 | 110 | input: input, | 113 | 111 | filename: 'foo', | 114 | 112 | nodeVersion: process.version, | 115 | | - analytics: analyticsId, | 116 | 113 | }, | 117 | 114 | common.mustCall((err, output) => { | 118 | 115 | assert.ifError(err); | @@ -121,18 +118,6 @@ testData.forEach(({ file, html, analyticsId }) => { | 121 | 118 | // Assert that the input stripped of all whitespace contains the | 122 | 119 | // expected markup. | 123 | 120 | assert(actual.includes(expected)); | 124 | | - | 125 | | - // Testing the insertion of Google Analytics script when | 126 | | - // an analytics id is provided. Should not be present by default. | 127 | | - const scriptDomain = 'google-analytics.com'; | 128 | | - if (includeAnalytics) { | 129 | | - assert(actual.includes(scriptDomain), | 130 | | - `Google Analytics script was not present in "${actual}"`); | 131 | | - } else { | 132 | | - assert.strictEqual(actual.includes(scriptDomain), false, | 133 | | - 'Google Analytics script was present in ' + | 134 | | - `"${actual}"`); | 135 | | - } | 136 | 121 | }) | 137 | 122 | ); | 138 | 123 | })); | |
Collapse file Copy file name to clipboardExpand all lines: tools/doc/generate.js +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,7 +38,6 @@ const json = require('./json'); | 38 | 38 | const args = process.argv.slice(2); | 39 | 39 | let filename = null; | 40 | 40 | let nodeVersion = null; | 41 | | -let analytics = null; | 42 | 41 | let outputDir = null; | 43 | 42 | let apilinks = {}; | 44 | 43 |
| @@ -47,8 +46,6 @@ args.forEach(function(arg) { | 47 | 46 | filename = arg; | 48 | 47 | } else if (arg.startsWith('--node-version=')) { | 49 | 48 | nodeVersion = arg.replace(/^--node-version=/, ''); | 50 | | - } else if (arg.startsWith('--analytics=')) { | 51 | | - analytics = arg.replace(/^--analytics=/, ''); | 52 | 49 | } else if (arg.startsWith('--output-directory=')) { | 53 | 50 | outputDir = arg.replace(/^--output-directory=/, ''); | 54 | 51 | } else if (arg.startsWith('--apilinks=')) { | @@ -85,7 +82,7 @@ fs.readFile(filename, 'utf8', (er, input) => { | 85 | 82 | const basename = path.basename(filename, '.md'); | 86 | 83 |
| 87 | 84 | html.toHTML( | 88 | | - { input, content, filename, nodeVersion, analytics }, | | 85 | + { input, content, filename, nodeVersion }, | 89 | 86 | (err, html) => { | 90 | 87 | const target = path.join(outputDir, `${basename}.html`); | 91 | 88 | if (err) throw err; | |
Collapse file Copy file name to clipboardExpand all lines: tools/doc/html.js +1-25Lines changed: 1 addition & 25 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -62,7 +62,7 @@ const gtocHTML = unified() | 62 | 62 | const templatePath = path.join(docPath, 'template.html'); | 63 | 63 | const template = fs.readFileSync(templatePath, 'utf8'); | 64 | 64 |
| 65 | | -function toHTML({ input, content, filename, nodeVersion, analytics }, cb) { | | 65 | +function toHTML({ input, content, filename, nodeVersion }, cb) { | 66 | 66 | filename = path.basename(filename, '.md'); | 67 | 67 |
| 68 | 68 | const id = filename.replace(/\W+/g, '-'); | @@ -77,30 +77,6 @@ function toHTML({ input, content, filename, nodeVersion, analytics }, cb) { | 77 | 77 | .replace('__EDIT_ON_GITHUB__', editOnGitHub(filename)) | 78 | 78 | .replace('__CONTENT__', content.toString()); | 79 | 79 |
| 80 | | - if (analytics) { | 81 | | - HTML = HTML.replace('<!-- __TRACKING__ -->', ` | 82 | | - <script type="text/javascript"> | 83 | | - // In all the browsers we'll get '1' or 'yes' (FF 32 or above) as a string | 84 | | - // value when enabling 'DO NOT TRACK'. | 85 | | - // For more: | 86 | | - // https://developer.mozilla.org/en-US/docs/Web/API/navigator/doNotTrack | 87 | | - function isDoNotTrack() { | 88 | | - var isDoNotTrackEnabled = navigator.doNotTrack || window.doNotTrack || | 89 | | - navigator.msDoNotTrack; | 90 | | - return isDoNotTrackEnabled === '1' || isDoNotTrackEnabled === 'yes'; | 91 | | - } | 92 | | - if (!isDoNotTrack()) { | 93 | | - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r; | 94 | | - i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)}, | 95 | | - i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0]; | 96 | | - a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document, | 97 | | - 'script','//www.google-analytics.com/analytics.js','ga'); | 98 | | - ga('create', '${analytics}', 'auto'); | 99 | | - ga('send', 'pageview'); | 100 | | - } | 101 | | - </script>`); | 102 | | - } | 103 | | - | 104 | 80 | const docCreated = input.match( | 105 | 81 | /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.[0-9]+\s*-->/); | 106 | 82 | if (docCreated) { | |
Collapse file Copy file name to clipboardExpand all lines: vcbuild.bat +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -458,7 +458,7 @@ robocopy /e doc\api %config%\doc\api | 458 | 458 | robocopy /e doc\api_assets %config%\doc\api\assets | 459 | 459 |
| 460 | 460 | for %%F in (%config%\doc\api\*.md) do ( | 461 | | - %node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% --analytics=%DOCS_ANALYTICS% %%F --output-directory=%%~dF%%~pF | | 461 | + %node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% %%F --output-directory=%%~dF%%~pF | 462 | 462 | ) | 463 | 463 |
| 464 | 464 | :run | |
|