{"_id":"@redsift/js-lib-google-analytics","_rev":"110-cd141a64320819bdb77e814dae1805d9","name":"@redsift/js-lib-google-analytics","dist-tags":{"next":"1.2.2-beta-0","latest":"1.3.0"},"versions":{"1.0.3":{"name":"@redsift/js-lib-google-analytics","version":"1.0.3","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.0.3","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"4334a5550e33893e6622d479d228a845bd8d906b","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.0.3.tgz","fileCount":13,"integrity":"sha512-tuw7dtMOAx0CWUSAdjn+9cpEZKnfMgMjXOz6jN5FBIW25ONLMvTdj3Wn9RHcOgE2/GRZX+5AbFF9k4jsznJiAQ==","signatures":[{"sig":"MEQCICiTwxcpa2wZZQ2LMEP5llGR7PrJdFt7WTTd7uNvu7pfAiBJxIZpiywEdRkWp1qb4PVrUiqugV1eM/89C98miU3Cyw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":377085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4HLcCRA9TVsSAnZWagAACNQP/Ai3kVLeFgDW8uJ9qDlb\nx6XYYH414dh7fHUKHXYSM6LoPaMc2561ql7NDgn54AO6LrmiNw99+A/MA+Bo\nEI8oLKbCIWqBmHVYgGB9E0GSYA3xOfcG78+kJRdW8Y1H8JU6obyQ5y7wRvtP\nTEE2C/HImTlPDEkR71uk8MfVnRaQCEVmWbnONg7MHvpNwC4tfh7Nmlf/rK11\nNy+USqQebAePRQl+zdh7qE0WNDqwGtWB1Q7ZK8wHAQt7660tE0L3wl3Q/TlM\nxeSgPJmI7JPReUMwOv4OrI7bIGvguQziSH7daowZ/gPdmypbFoBN+pgopsne\nOtNTLZ5xRozk1XnIl22lKq+es0+EGZs62i2HM5eJpaa0Bfb0QcWygO5Wh3jo\nQhISv1Zyjo1gmVJjqfPwiE9EyfKtGpkq+DQ/7DsO2qvS9I0eS/uHyfICcTNl\nYxokT0l4T9KtFM2Xsm94knSwWpjisQwJZ9UtEu3l+ByI6NJ/1EIQ8J1SrW51\nl86SLehZu6vSHjTdWMs+Iqw8hxj5/mP7+hggIl6eqEe5lOn1NVWmvl9vXIIh\n0y/dMJuEzxXZDxx4YQK5bAPaIsbcAO8/WtQD5L6NP8lMWFQqJg11dCV6B7Vv\nJsZFs2UKYTD/jsDCwuSK/b3B+QZtbWHIJz0gGb65aeH7oHJH0FikbPm+8dKs\nAIP2\r\n=QsVn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"69675da7341aa2ae40b532ba80a4f6d481a95580","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.0.3_1541436123684_0.4226005459379498","host":"s3://npm-registry-packages"}},"1.1.0-beta-0":{"name":"@redsift/js-lib-google-analytics","version":"1.1.0-beta-0","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.1.0-beta-0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"833fdff1a14aecb2875237c29b5eb112b60b3c14","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.1.0-beta-0.tgz","fileCount":16,"integrity":"sha512-GuMKR51Q8FS+8i7LsXAvFpZbyFXmtIUolk9TpJrFE0dQErBR1HvmWWpU5+7s2uWdtoYT6YfKSRJsQYWkSdgbwA==","signatures":[{"sig":"MEUCIE0YTC5PORI9/F983bPut9mG+moECaL4qHRfy5O27da3AiEAqrGcq22/4gQhM3Cb4zNaRY7gCWIYLlmXlM300gRwi+Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":382207,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4a8sCRA9TVsSAnZWagAANpkP/R60j/WB0tKAzvJ4WaFr\nOXrJ/tYGXRnEQrhyietopGKU1c8P1JErS+b0U/iXL7QYIXezwfrego7wWx2n\nOiZHcvNPaPjMN539y7qpfZzETbcLXiTbFxfiNlkwZxJjkOdlgLjQfzqRHrSJ\nAYZVTc69Bv5wLqAfEWtIkuZVSrsNU86Rp7DkY/ESIcy/SZnStMvCn+ZCsRPi\nJteejAEhA3q/NJTnEehGWDf7ZsMutbgmxi1xoCeSR6+KJtPx4kbfmNjnhQvo\nKbodKSuHVhxJQDOtjnY+EnA5cn4PWAlHimLc46U8ucQxjfIofskIj6yURmZp\ndG3gNnfm3oosiB5YqaKS+8JSA2L8IrI1K0tytgi/yS804BC9FvzRCc1Oq4XE\n71rko6zFVXLnBwa8Ea7k5Nls/GjlNVsz0IM9aceopqp+a00rCfGUy2aLmt7l\n4g4MsSHtUV7tTeq98rdZiMQ1IpHUld336FboFNlT8TXB82nUwYB6Nlq4Xnpk\n3ir+YsGTSo1gvhk47iJUkekJ0QTLyB8Ufm30V4yWATJiNCk9ZZtX4/SFdE5l\nf4yp7/c00fEGQpq4aEy7ZzRlK4dTRg/p1lkWb9AJVtNquDZ3kCCQtJP/0ex7\n2QOp4r4QNyNiphqQm0WhdCJsjg+w2WvpkkIHdvTr54zFWCARVfV4XnnqN5uD\nKIbD\r\n=4Xmk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // configure the `pageVisibilityTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/page-visibility-tracker.md#setting-custom-metrics-to-track-time-spent-in-the-hidden-and-visible-states      \n      pageVisibilityTracker: {\n        fieldsObj: {\n          nonInteraction: null,\n        },\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: ['_UA_PROJECT_ID_0_', '_UA_PROJECT_ID_1_'],\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will send events to all projects referenced in `uaProjectId`. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `hs-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `_UA_PROJECT_ID_` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"65ed02615cc312ba74cba0d8379a250f329f0cef","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.1.0-beta-0_1541517100059_0.8462267594326522","host":"s3://npm-registry-packages"}},"1.1.0-beta-2":{"name":"@redsift/js-lib-google-analytics","version":"1.1.0-beta-2","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.1.0-beta-2","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"30c76f269b4871c8d3e9a66682a7e874e172b23c","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.1.0-beta-2.tgz","fileCount":13,"integrity":"sha512-XbfkPUcahu8q5GE/+oo2IQeUalvNWO6KxRHXHsGeKoch/h3F84gf/pQr7eq6Cm0AjHkWuN7FklzVsnAj9H7yvg==","signatures":[{"sig":"MEQCIAwwHCd/PLNeYGpGKDQ+aH1gZt+eO6Dec8RXtrOjftnmAiBf3DCE0Z9dUxeLOsnSPGhFDOvTwjekILjmJSzpyNu9FA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":381150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4cQtCRA9TVsSAnZWagAAadQP/R8NrB1UW7nBGFfNx0VE\namSE9lftRHWIOk5DAELtHr61WzXUIWh8QlT8wxNdb5mfVhFVREDzC3oClhY0\n85DjHZFd6ORBx+7WZ4jMP2iVNU21i42y3h/6z6tlmp3OXDafbT0lQo6Q8RY8\nVJA1K0z2Ve2oZd6jBPUCms+7Mp40/EpUfxff+u9Db17QAPlDGvfZDCQtlPue\nUSjKtCmWGgCS4Q8VWQsHnfwSVrNtdf8+f75Cm9QLt3GrMRRkE24OjIN/Q01B\nM8uIzwaVVJX5cBxbAqFzKxeTLqFGQz99crpnRzFzDaxXOoaYiz0D2GmSKMk8\nabGW1HaLuYdoxTr5CCCrMeh3Yv0kAtcMOY0QU8pRSEDRJzYFw3C3KER56LRz\nrewE2tBFZIAohH5B7dDZqvQOxKtKhte7Ps1Gc4fpo+ZLaagVM4rLqggcOmts\nk2UoPxLDjgHOQRrLga7Da468nNTvZK6XD197KNa3SdiLN+LX8L15GHub7+Q4\nmLq9Xqt+YKaWm6UmeH5DWTs+b9zhOfN0s3JNrAtjn+3jwNJHv5LKqLMwiyTP\ngxffBczkDsuOK1fRD66Ksy+BlxeRHKmnRFaBN5Y7Rc8x9xtl+JAg4BIzOry4\nvEhHDgmV+ufJUVmI4wh4QJKt78R57VWxGdDodksUwE8sf4Rzatww9KBpwzrk\nHIPy\r\n=93zi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // configure the `pageVisibilityTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/page-visibility-tracker.md#setting-custom-metrics-to-track-time-spent-in-the-hidden-and-visible-states      \n      pageVisibilityTracker: {\n        fieldsObj: {\n          nonInteraction: null,\n        },\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: ['_UA_PROJECT_ID_0_', '_UA_PROJECT_ID_1_'],\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will send events to all projects referenced in `uaProjectId`. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `hs-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `_UA_PROJECT_ID_` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: '_UA_PROJECT_ID_',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"e8aa36b73c9864bc3831f6189c1177798078dbe8","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"6.2.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.1","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.1.0-beta-2_1541522476751_0.321638355320617","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@redsift/js-lib-google-analytics","version":"1.1.0","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.1.0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"563c7c0a36ca94313975d5695d9da9a7d2dafa3c","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.1.0.tgz","fileCount":16,"integrity":"sha512-z+hsyc3vmzVttI5PHAj/GIjMeqRHZaQfmWIpw8ow6k8+xUboYp7o2YV33OA3LzocT49U1K73L5iaRp1ny3hdGQ==","signatures":[{"sig":"MEQCIBcgFIUyAhSd6ZVU9pbUhaY5aq3YS+SPmKUPdJIPpA8gAiBt4RicIiFZ+/Jg9IQE5HpHOF838PacVcoCKbB+In5xqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":381931,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4c6jCRA9TVsSAnZWagAAoG0P/0vV25S8yhukybkFEaP+\nRUYGdqhTQNiA1uB6QXsqJypeceuy7n7OhvoWHuk0FLc/ndELmBU0QBlE1QMN\ncBZ6Rzj810+8B+LPv2wdHG+BlDeGmyn6dVuQP+NP3/rk0JusSCeRWCkBiM1L\nlnK854EkNEZFAvBxeEphHRiOk6J89pvhatopoFK/NznWw3eGf6d9ifLGtKy8\nWu+6po5viibSQjIDYKepoXa4s5e7yLhot3DYFlYv8qthRtTxmAKzpqwut5N4\n3KK+2g5nB5du4JImXSYOoqKyNdvu17L/r4TmAyP2W0jJScN3MY8qxfvxZ+Bu\ncxvIvrShr4N4rsawR672nzpQMUczRc9Z4wAXHLoGJyZJB7q1ZOS4o9qnKmiK\nEmsWei1dgqEjy1Q95Iw0X8MbFdl490JXcwYTslrm01KKRl8vIc7rS9vydxHl\ndO+TI8YJIABzNvjowAtPy0XKUWv4JEi2qdpjkrwoAOFqibbtLWNs70V6rz+x\ny+wu4nEGBCRnswO7Dai01nrGIRyw4J0ly1suwv3kKVOQPo6tLDshhYkDiF1g\nxta75xhD8l7ub3lWmWOfaaUSbgkgs5VQVhJhUumpnS3pC+o95Vb1qpIn/Cv4\n7ZAt50zg6g6ESjU4vNoNnSxny0e7JcNWiA79QC5jTYnAitqmaS3THhAq8jdI\nVFJM\r\n=Xb3L\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"1183544eab6e3e61891d28f26c1d08e13764df8b","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.1.0_1541525155190_0.37286287210757885","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@redsift/js-lib-google-analytics","version":"1.1.1","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.1.1","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"e05a448fd77ef82049aa05b4ac4b5662c39d17d5","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.1.1.tgz","fileCount":16,"integrity":"sha512-yDRQTjW7dFyTP+psJ5ADOcngk/FCYwiM8kCChp1CGLTuVF5pYV7+cCgIweR/nqJ4oy/hySQZTl4bmh3UBi0HUg==","signatures":[{"sig":"MEQCIF+4s18L+L/ojo+/NBu3DPbKKieqrxJv05w3RngSbLCtAiAvoyuxc/qZEyBVO7D1as11PQTkMhAwB3g/Ixy5l0+PrA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":379512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4dGkCRA9TVsSAnZWagAATusP/3jMWUzTKqEOBr7Vwv7h\n7lwaJObffJ3mCRIW9nautA2qM/6k8+wBenlusP+cexuF0cS6f9fZ7Yzf3Jy+\nvDAAwc/WPUDGEHL1GO459MsTSTz7PMgyLye/j3IQJ0Ku5fQBYUY/y685Awm7\nWIQ6afQmdapDN2QJoHbEK4Y+o6iPryjp6HkLe/qtkNroonaJPhImcYN8EvIc\njkvAeJjuy3F4mHWInXNnRQkIcP4TmwQBFLS6djDO2k5F/agDX07tciFiLRXg\nq0josWfVZcChTa9QYjetMIeXpkUvJJ5ASq76xUz/GWibExujIkaxxTbc+42q\nhzdVgkb/WtXBycoofssYMzfvykTjitn5smBzI338X6F9lg0GdVmGmS1BDtHl\ng+Z98GOdCOKgtnl8RQmYloUc1xDV6bU4x56YLey83vonccnfPoXtfDVDcfin\ngx7xaBbDn5iHagDQAwBeIwNbsU7PF7PyX7ZUjFJrSDGz8kETmVsRktYlCUQ3\nnmPIulxUMRA+a6nEAo8XuSpuzTGHo1e0V8HU0paEpWlR7AaUj5qdEndPmaG2\n4rwyl3K3p7NSmu8684epnD3pDou1R9x78ICt13AIZYuZAmEc9TyeMUWLu0Bt\n35sVAWUYVtfh9fgQ75jYnr8+Jwg4as4J1zG9FGnLsHE7KrKf5Mt1Orwir8gs\nkfre\r\n=2w49\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"1183544eab6e3e61891d28f26c1d08e13764df8b","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.1.1_1541525924042_0.4775628148080395","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"@redsift/js-lib-google-analytics","version":"1.1.2","keywords":["ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.1.2","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"101894497f1ff75365e442e16e97a771b35791c9","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.1.2.tgz","fileCount":13,"integrity":"sha512-733M6hw2Jt7sMb0+ufDUTNapXOhAiu04scviZLVhQaL0NtxOS8qKcehL7FVc8Xetpbq4vDu+DwIXbXypJvTkXQ==","signatures":[{"sig":"MEQCICuZGI7wznj+LbBFt9jCfu8FYNdUrb5o/aYfvdf2c3CZAiB8VusriM2AoC+m1xaIkSX8XVXVPyymsrjRttH6Lmt6oQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":378046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4djbCRA9TVsSAnZWagAA97YP/3OFU5TObCcsnADAfHb7\ne4V7JLkITPgNdYrIv/908BzAz8IiAgcI8ouXtYMeVa9J2HHLprIxlJZwJCWB\nIqkX7Y4+n7yZtOw6rqbh+5vD+2wPxyuAojczUGwF9tiSZaI617fjwzofLcf4\nkZ5yjKsnkQ2o4/CxiOHVJcZqVoru/UGKdBqldiJCGjfNM288s6aetOQiAC9P\nJa8h/KpwbftoOH3ejJjDAzwDtjWVJ7PJUBv0i9nxWqXrCE+7HwjP+OW9jw2q\nTfuwbq0/r5+/AFS0ntZWaRzhJZa38ZqrWxTwtho60FODqm4ZlogZCItxuDxr\n9IuMoWEd5eRQjRQ2IO/zoVqzYl6VjWnb2B6Imw9poJ7VBdWKs5esyJxjhBVP\n1gRu3qqEHC0BoAUzsGz7/WweT2klyLIuqqf/oLAKatxoISjKi+BNWHQXpcUk\nd4K2/JVlZ3IJFiFxh047Lc4L934FuMWnXyIYzHdbDM0IVdDD2rYVmuzKJqxE\nR6jzag0AbP5we7mUw5/8AQy+jLMii8rKYZoEMSc/jkfpAcK5An55/L0a2bxY\nRdXzyUQ+HA2z3bRRML/0/cohivUoXEU0wvD4chVD2bZvjmeAosZx4rHHgHF3\n9ZDW2aZZQBggtjK3h3JARQnqLcEpHKHORt6a9/nGyw9CZrTRDxn9GEaVJbB2\n+zdl\r\n=KKxP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"78c07a236ab94f79b683a81b90650515c679da8e","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"6.2.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.1","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.1.2_1541527770562_0.335613664989884","host":"s3://npm-registry-packages"}},"1.2.0-beta-0":{"name":"@redsift/js-lib-google-analytics","version":"1.2.0-beta-0","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.0-beta-0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"f700883ea8cfeb51c5c4481ac8cd14cd79024be6","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.0-beta-0.tgz","fileCount":17,"integrity":"sha512-o7RcvAZRfC1u2mKQ6ALm+IueSsP+GMTsgvAH6OEk6XLExh979+yMiAGW2S4P2blKpEk8sxw3MG/RqWFlYW/7uw==","signatures":[{"sig":"MEUCIQCqWdnNHoZOIhtHmYRHG8uNfdtlnPHnzwNTCW1vwIlarAIgNQmPHKfIk+0QdhrNeIAgSwvMEq60KoPgUJVVPC8dQvc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":396009,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4spsCRA9TVsSAnZWagAAe/8QAJHULrQXehElQQSCPcDp\nnZ4NZoAtvaO866acLBQIL5IdUpn2iozQkQHtVWZQTQbe77FbaiUiximNtCa1\nqx9gZ909HtM8fS9M6ZxQBbwleYJoOfgteTGIebQigmy0CIL//JskSXX5jw1J\nrUYjGn9rOVHS5r79ySAmDXpB3T6kYu8DTlJSQ9yK15RLufH2Lz1qrU98NlPN\nRX+JfiG9Gj2wTYo1dHpawnfZ8jVyw4oardLBLg42g5glwkgG2pcu6copVw8a\n3GN1gCYhpjEKWtCejSV6ScxxPk9Dsf/3szJAIhWcVoVxwF5DdsGgszwPspOH\n6o8MfzGjHvtmuJxgGxyiJtiD5aHbHLXQD/8FUNHcPLb6xhFDlxqHPKanW+Gk\nkYWXmqVOibAWlWQMQdZJ/wCZtBJb7WWhqw5exLgIz9CyGvIE9ymjg7mlSYi0\n6nICCxoixUsHWHRDSzNZ+M37FhcJgI9Eu7GDstaE27YE60lquNhfpsZz/CZk\n8jQ4F50w/UVPwsXY9ywjNnUEyRlsOGg1b/RkcLMF97uWTLglqTA9j0SIztxY\ntFdaJk4xhNL4+A//Q6bJ+OsBeEvPyuLBLsizLFLmnToecUr+viMSq7tfpyYf\n6qloZGaGKvtMx9fZymBFkw+Vgda9lLxUeyc3tXWXFnahbMmjz87sDmsXoML7\nmgDQ\r\n=j2Ww\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    cookieName: '_ga',\n    anonymizeIp: true,\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference?hl=en#clientId\n    clientId: null,\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n> NOTE: If you don't provide a `name` property to the config the tracker name will be derived from the `uaProjectId` in removing all `-`.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst configs = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(configs);\n```\n\nThis will send events to each configured projects. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `@redsift/js-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `UA-PROJECT-ID` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n\n### Trigger events for all configured projects\n\nAfter you called `setupGoogleAnalytics()` you can send events to all of them with a single command. Please note that this command only supportes 3 parameters max:\n\n```javascript\nimport setupGoogleAnalytics, { gaAll } from '@redsift/js-lib-google-analytics';\n\n// ... setup you projects\n\ngaAll('send', 'pageview'); // Sends a pageview event to all configured projects.\n```\n\n### Configure a session based cookie (which immediately expires)\n\nSee https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#cookie_expiration for more information.\n\nTo create a permanent cookie after initializing the session based on you can call `setupGoogleAnalytics()` without the `temporarySession` config parameter. The `clientId` for the cookie will stay the same in this case, so your GA project will treat the two sessions as the same user.\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst temporarySessionConfig = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    temporarySession: true,\n};\n\nsetupGoogleAnalytics(temporarySessionConfig);\n\n// To make the cookie permanent call the setup function again without `temporarySession`:\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\n### Get a list of the configured project names\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // Returns a Set of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n\nconsole.log(getProjectNames({ asArray: true })); // Returns an Array of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n```\n\n### Set a custom project name for the tracker\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID-0',\n    name: 'MyTracker',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // ['MyTracker']\n```","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"78abf72d20f6b4ec875e5b472c13ca250475e994","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.0-beta-0_1541589611333_0.43594421245465065","host":"s3://npm-registry-packages"}},"1.2.0-beta-1":{"name":"@redsift/js-lib-google-analytics","version":"1.2.0-beta-1","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.0-beta-1","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"2f9baf2a5373db0ae42be545d053bed1c5619d57","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.0-beta-1.tgz","fileCount":17,"integrity":"sha512-UR1cRAmIdADyUmaZ0DlziJ5IS684XqCDP/JdmbK1R96uknqcZkB1GLpxcHvGXeA1Vj40H5gZCo95lTfZ7Aw2yw==","signatures":[{"sig":"MEQCIGFwniZaz6WmSUtUUwEav1oTwMMSYJpOIuVsYSUkKvxAAiAbxeL082BrC5U5YPEyPaVHwos85eT9rsGHyUmk7fQOVA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":396148,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4s9oCRA9TVsSAnZWagAA9XsP/13TxYlC5jww7Tq9fTcs\nM28sQAGV2XZrsqrEtbkB/0a0LOBfcgoOrhaN+w2Qjte+hWKqs48E0+m+2tHv\nri9tJaHjAfXVF2ncSWthThyvKTUwjLh/wsVgtmwGhVd5GcnaFV4toYR4EtGs\nLxWUPmFFbshvDXMOhNHwecp4LWoDa6gRnQxsg5kkKoSms0Ni7fAXr8f5LO4p\nUJeumXCTpfv07iYL/xKkaGtdGE5l/8Kuq9eZ780KGGBSpwsDyJH5LPqXMiKK\nPVm7vGAF5tPcywk9YAfXk+7n3ZAv69XQIv9U+VBj6c68abRYVzZGcWaRAtEE\nbDS5bNBjRwaQ7QApCWmcTJ35ilzhs+y2ws8nDd2h+XFxdKjmxXxHRHbsKxbo\ndvKD0HnY34vfi/PH/Mem9npQ5GB43N4AVUbiB3GN2juPbTJ+2HUw0EOPt7ss\n8cFrpLUMaRs3mL1X+1wvav68bU0zJp9ckCjmof5tem4WFV02RN9ynkadVNEy\nI77CBOEEj3aJJb2Cg0UdS2Y5Qs+YN+xPpawh7w5gJ2FoFhYEONygocnguhqH\nKO3h4uGpbHxj1gxd1r0oHvhv0Ia88frlCYq6Pt3AB/9d+rS52RWKhcvaNFbx\nOz+Ho5FFLFZ7gtiJH/yr+JCs1J61s2ljgES1r8ArevUYRS/ZFGmeXqlt24RR\nfgu1\r\n=rKva\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    cookieName: '_ga',\n    anonymizeIp: true,\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference?hl=en#clientId\n    clientId: null,\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n> NOTE: If you don't provide a `name` property to the config the tracker name will be derived from the `uaProjectId` in removing all `-`.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst configs = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(configs);\n```\n\nThis will send events to each configured projects. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `@redsift/js-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `UA-PROJECT-ID` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n\n### Trigger events for all configured projects\n\nAfter you called `setupGoogleAnalytics()` you can send events to all of them with a single command. Please note that this command only supportes 3 parameters max:\n\n```javascript\nimport setupGoogleAnalytics, { gaAll } from '@redsift/js-lib-google-analytics';\n\n// ... setup you projects\n\ngaAll('send', 'pageview'); // Sends a pageview event to all configured projects.\n```\n\n### Configure a session based cookie (which immediately expires)\n\nSee https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#cookie_expiration for more information.\n\nTo create a permanent cookie after initializing the session based on you can call `setupGoogleAnalytics()` without the `temporarySession` config parameter. The `clientId` for the cookie will stay the same in this case, so your GA project will treat the two sessions as the same user.\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst temporarySessionConfig = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    temporarySession: true,\n};\n\nsetupGoogleAnalytics(temporarySessionConfig);\n\n// To make the cookie permanent call the setup function again without `temporarySession`:\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\n### Get a list of the configured project names\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // Returns a Set of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n\nconsole.log(getProjectNames({ asArray: true })); // Returns an Array of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n```\n\n### Set a custom project name for the tracker\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID-0',\n    name: 'MyTracker',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // ['MyTracker']\n```","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"78abf72d20f6b4ec875e5b472c13ca250475e994","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.0-beta-1_1541590887725_0.1179395863260102","host":"s3://npm-registry-packages"}},"1.2.0-beta-2":{"name":"@redsift/js-lib-google-analytics","version":"1.2.0-beta-2","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.0-beta-2","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"ceb47491aab58fba8f8e9ca7594fd3c2ccc87c43","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.0-beta-2.tgz","fileCount":17,"integrity":"sha512-8nJ0jENld6oOcCqMvWMRsYNJtcKsVHbkzu9UKfzlZ1+8oVMCQ6YMOyPXj5jCQF6ChV+swrf2E4gPZVmF/N4YIA==","signatures":[{"sig":"MEYCIQDpkMRW8GkW0TnRa3pmyuyrmIiN5d2cAfTpz02bqFVz/wIhALUklz/7l39EH9URvTQiOa3R9QbIaTe+cFLUWdcK170c","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":395765,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4tBBCRA9TVsSAnZWagAAAaEQAId/rh/Hk75W+Vte+N3k\nm+VlsF34ISh6YRdfPjTbsaE4DxVuuQEm06RZcpiG5/qnKxGFttpyAuYznVin\nHEhIUbcL1FZhmGwYnFz0n80NEKtghwCk44W0WxzGJyJhywaPHoHzvHFwgy6j\nb53yzRS2ZYmn8LCEiy5xpBLVvuT5/6i2hD9l9yd9SNc40cRW8DvIJdW7SZxG\n4CmqWS1XMXqRzZb0oPOYO7q4T4Bn7A7VyuyRtrB63umsN52tJrmV2B4HJu3V\nNmMJREIZfKmVu3B4/LE+FtPYI6pg3KsbcpYvXB+MmzTN34N02zSiJJ9cCSYe\nPqG0kmf18jSY+XDf1VcRqvVyAvdys/kRcOonQLoHfo4sgYXmMBPuDJDM6NDu\nNT6b4ddaY7iOk03xZHvftqo/wr9Tf9RaKnQaJDeDv6YzNsogartyxOcuOzrv\n+JFLdVZ2MeTZcLgRGgVLV6blAuPNX5qgrsdROGyT7q0JRre7CV62VUBjkpZd\nPkS802YF+26LAXkB9Z4CNvQt1xiz+elujw8FjC1Ctpt8S/eqNIfg0Uu+oQOO\nthP3Q5dOaKP0bx8UXBWS1vtpc3N1DMsKb2nGowQr4njViy1vCd2j2sXYU2FM\nWI5BsUogndmqzBSdwRoYopEkfFimcXvHP4O8Is4ousZntOKz8+A73OVLIrNA\nzpcT\r\n=70Nf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    cookieName: '_ga',\n    anonymizeIp: true,\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference?hl=en#clientId\n    clientId: null,\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n> NOTE: If you don't provide a `name` property to the config the tracker name will be derived from the `uaProjectId` in removing all `-`.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst configs = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(configs);\n```\n\nThis will send events to each configured projects. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `@redsift/js-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `UA-PROJECT-ID` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n\n### Trigger events for all configured projects\n\nAfter you called `setupGoogleAnalytics()` you can send events to all of them with a single command. Please note that this command only supportes 3 parameters max:\n\n```javascript\nimport setupGoogleAnalytics, { gaAll } from '@redsift/js-lib-google-analytics';\n\n// ... setup you projects\n\ngaAll('send', 'pageview'); // Sends a pageview event to all configured projects.\n```\n\n### Configure a session based cookie (which immediately expires)\n\nSee https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#cookie_expiration for more information.\n\nTo create a permanent cookie after initializing the session based on you can call `setupGoogleAnalytics()` without the `temporarySession` config parameter. The `clientId` for the cookie will stay the same in this case, so your GA project will treat the two sessions as the same user.\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst temporarySessionConfig = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    temporarySession: true,\n};\n\nsetupGoogleAnalytics(temporarySessionConfig);\n\n// To make the cookie permanent call the setup function again without `temporarySession`:\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\n### Get a list of the configured project names\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // Returns a Set of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n\nconsole.log(getProjectNames({ asArray: true })); // Returns an Array of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n```\n\n### Set a custom project name for the tracker\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID-0',\n    name: 'MyTracker',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // ['MyTracker']\n```","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"78abf72d20f6b4ec875e5b472c13ca250475e994","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.0-beta-2_1541591104467_0.1665147419994859","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@redsift/js-lib-google-analytics","version":"1.2.0","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"2451bcf21bd420a06a5cc563613ac555c68acdcc","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.0.tgz","fileCount":17,"integrity":"sha512-biMjo0Q2dus/UK0mjBO4iF/CLmCKySmjz7un3Wc6JTAi9x/aYxoDt2n8r+8iZTgkWGdZaMgyUZOdflCzkA6P4A==","signatures":[{"sig":"MEQCIGveMiJKsGuj4weLhTzeqgFt5Gz3TCh82GSH60pvUso1AiB9M9xIiR5nLuZeWHX9c0ImAFZDrV6OiXyxot5MZDuo8A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":395940,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4vIhCRA9TVsSAnZWagAAz+gP/0SWsCNDhAEvw5CeDwS1\nHYxSM6gzxUUv0oVURkcb+YmsivrhKPxYO6PsY/uCVqEA6hpiokGtwPkSYIoI\nCVrQm5LDRerxoF21cD2nlAFEFqEBuZ8EfUAjKtNDjeV7cLb0wOuV6L6tHVGW\nL/VhZNl9dz+2bjn8j8fYAQyqzClWi60eGXrNXQxIU6mL9Qe+/rj5+KN/hBAy\nMi3aVWtFq9I5do3B/6BGOlnc+BmRDJVFDXFR2T0A5ft2F6hgd7QH22eYVvox\nxbku5m4mFVVMwwlSd3Te70B17R9SAl5mYEQ0NMbJSmQxBk4ynqMlSG8ib7s3\n1JaIQfYwlLRXri6EY44SHqExMW+nBXopvd3yB8/2uFWTlwoHWKGqpoxTbEku\nWT1GISyHtxY6HrKes+4fni+LorP3UTnKSvDJ03BwL+Tox+nAA5xvYFRyIQKT\nyPCPKNZdVpcyc1MMnHzn2NHLBZpF64oBQCq7t6xTji4i49zR3YpogTzXDlzm\naEIUeg15kM7jSDpaFf1eW8NreHpHHLTQPe5LqySqedewkCn9a5x2kvno0a8B\nBqs9s1gA8iXWTcralYAsyMEOIXsuCQgyCSLQ1Q+x3sZ6JEWRUnH4WLyhruMK\nS7CyHYPngYxqBn6gF5cfHLyfiKzqFBnPlJ1UnYXiHjtYEYOkC/kPZ44rJb6/\nMyDC\r\n=boDQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"e32c9ff2bacbc9924c8a01416f3163ecde7ad1c2","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.0_1541599777038_0.6146728508442358","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"@redsift/js-lib-google-analytics","version":"1.2.1","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.1","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"a92400b98c8a4a13adf492b2108e44170abe9ad6","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.1.tgz","fileCount":17,"integrity":"sha512-0ZTrZYT6hXQleDYfbB+MjfExsDwpIn7iqu90eu1U8+jhPAkteqF4+0/AB11DgCDcIcsuXpcCB7AEfB0wc+U40Q==","signatures":[{"sig":"MEUCIQD4tiVL17/u5wwJXNoQWXcpwDmW/15sp1QBEb7q/Fx4RAIgCOZ29YBLJIKK+saB9ZFdhMT9zcTW2IhCaZs4EmCFt7s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":395451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4vg6CRA9TVsSAnZWagAAyz8P/RwF9qj7dGLpzSSYtY32\nzaz2Mw4hnyAHeueF6K6F2SpYoQABLeZbcgpmCpTEyL8et3GeQvo7ARKOQxMk\nakvfvoYn9CRODs89yVY2GqJthbdMhqcurj3O2L7/podswB1KwW/2nSqpbTJ9\ntuOvP5FtGJWhqNfBeZv+VvhnN8Ynrd9JGZ8nl5A+fgUlVKkjDIzrX8aRX+/3\nTmEW8eG1wh9/RN1jU9VNDLx/ebdu0xlLZsKfw6CBNQWr6YEN+hFg7sQlJ7a7\nY5zPCxmvk627GzIJxAe7EEv0CPFcaJe443FrT+UPd5ZB8oFJrbeC1JOqKiQX\nXnYiRF/06/xsLIbnL9/Txo5S6FpmphjUP0jgELjIxQyjVbDfCPAXmnSvV7Vu\nrNqDcMJN+9rij0cjAh/Tsdt9mdtb4myHRVQW2OBnJyN3sMrLY11lpfn4z4h9\nAearC4DpTdNevbN5DTAM+hE7HGGM+xegPfsoRQO1SuCTl6R8wuaF58gz1E++\nvV/WTKQfmxrIfMW9+P4zq37xybbKfCPimf4ied4+pxfzJO9S+BmArsSHlD6C\n+h7LRvdjf8YUxAl2+Bg27uIPeuh7RwLz2TrkbIYYpWUm9y3JlxPTcXxqHBa8\n3SBh6e+AxMXWwdc5MjrjW2VQi3xTBV00KLivg5JbAccKvelqMb/kQCAiK+Qe\n5GiJ\r\n=BfSq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"efd525beee9465fafbb3a0e80ac5d03409375ba5","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.1_1541601338125_0.13304395480321074","host":"s3://npm-registry-packages"}},"1.2.2-beta-0":{"name":"@redsift/js-lib-google-analytics","version":"1.2.2-beta-0","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.2-beta-0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"949d37b098451d9669eb9bde64470b55d8ba6cde","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.2-beta-0.tgz","fileCount":17,"integrity":"sha512-mz/aSqvWmSkCLcNsePHqEzTq/tDXwMmA/B4MvHtsl4huos6SD2UN8hosGK2c70QQkz5JMjZ9WxOvW3kcwK6LNQ==","signatures":[{"sig":"MEUCID1gXp5PKoBEAxP+B1L+0EpM8VRIMEfoA+TFYgO5c945AiEA+zen+4ALcEuejxRkxVg43C5PhfQx7pBy7Qz+CoeQAdI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":402453,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4xJNCRA9TVsSAnZWagAABf0P/RZSscK+2/zkiJgJiW+y\nw/t1pztdWIpaBqwChGZ+ro+w+fggfMBjngY78lp1IdQ520kB++I4+GARuQHw\n/qlPWBoARkWu7aQZs3JPbAJ3vbSYRcZGeRmJ/cQ0XyIfMcQvfW0/BN13gOy7\n3DRHtZORgaMLny7UoyZ34Nalkl1mFkmywIKrJLjcxguumCh38NfyTPg6aHB2\nJQUMdjLhFW2V5NBrSsok02/IkOTl6VFiqtWF7yDmjQoVXhH1bOx9xx0iR60L\n2G29Y3MV8oXX2WW7q259WC+s3K6yzFjE+QzIVFdQxyae73ESo2mHkM/bg5+l\nJFFUrPcgL75So7+Obnqr4EhbqWj43orBlSFo7Lj7yP84+YOe68bWx+BLh78T\nf1r35esmkhFgTilDqw+0ObrkoMxmcg5QPQbn7vAuQNeRCr63ImZ/AG8dlnXL\nEq8H9xij/NYoFsKx7Ol9/YL24MX6VsSl5pBa+qG/UDo8MIGfjEISyq7COP54\nouQtqEl/S9qoo2bwrPy65HdcaekbmlYYYJ7ZmfYQQdOHQduxfIrVKGLiX0OG\nd+OpzC3484cgBZsxFywWkWwETjSapLC7DLQmUFUPaKuQI12owsVMa3SI4nFK\n5BEXZqyte3s02zGPJBAk39w2LyI0yPme1r8ElOa5OgIapzeS80EXXVWtZ2tS\nC0hC\r\n=Ovo/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    cookieName: '_ga',\n    anonymizeIp: true,\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference?hl=en#clientId\n    clientId: null,\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n> NOTE: If you don't provide a `name` property to the config the tracker name will be derived from the `uaProjectId` in removing all `-`.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst configs = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(configs);\n```\n\nThis will send events to each configured projects. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `@redsift/js-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `UA-PROJECT-ID` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n\n### Trigger events for all configured projects\n\nAfter you called `setupGoogleAnalytics()` you can send events to all of them with a single command. Please note that this command only supportes 3 parameters max:\n\n```javascript\nimport setupGoogleAnalytics, { gaAll } from '@redsift/js-lib-google-analytics';\n\n// ... setup you projects\n\ngaAll('send', 'pageview'); // Sends a pageview event to all configured projects.\n```\n\n### Configure a session based cookie (which immediately expires)\n\nSee https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#cookie_expiration for more information.\n\nTo create a permanent cookie after initializing the session based on you can call `setupGoogleAnalytics()` without the `temporarySession` config parameter. The `clientId` for the cookie will stay the same in this case, so your GA project will treat the two sessions as the same user.\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst temporarySessionConfig = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    temporarySession: true,\n};\n\nsetupGoogleAnalytics(temporarySessionConfig);\n\n// To make the cookie permanent call the setup function again without `temporarySession`:\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\n### Get a list of the configured project names\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // Returns a Set of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n\nconsole.log(getProjectNames({ asArray: true })); // Returns an Array of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n```\n\n### Set a custom project name for the tracker\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID-0',\n    name: 'MyTracker',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // ['MyTracker']\n```","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"3721c16e3de62c129ec62819eba15af18b50d851","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^23.6.0","@babel/runtime":"^7.1.5"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.2-beta-0_1541608012545_0.34046554959399344","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"@redsift/js-lib-google-analytics","version":"1.2.2","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.2","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"2c9ffe0c3846c370ff9280eac2311c85e3e49d5d","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.2.tgz","fileCount":17,"integrity":"sha512-lQRVNPlZtjdJwF6UYkZoxxK+ZizhQpPN0GQmBxULkvft/4ibWTVDZLHitFZ5qoC1GtPqJQwPSEimjG0c3LmgDw==","signatures":[{"sig":"MEUCID/fitS9ziF29wDHDmQBR92tACA8sroynN+I5jNcbNFfAiEA8L4tZLuoSbgPtKZXPhEwRkN7AhKIhAyu4mJxwsbrZzE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":406597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4y2DCRA9TVsSAnZWagAACYYP/1dDphFS8dmXmtnLj+7E\nZkzSo1Akzji6FuZ/j8crlZsfoTUSqyS8ypDYt318+EG6fjlGBuUqyuRbmksL\nmlYi6x/F4pwgviFUBQygluNN3miPvo59U9FR/pxPPao78niXiQ4gRBsvpF/j\n0q6Zj0/RFhvsuT5SURClMrJ7bI557A9fTOJMuaEnNtG6dtrNeCeoOwAGcyTg\n/TbgybKaZQJ75mttJEemgDQRs8LBi0CJukIpvN0ySWDgLWWxTQNJexgGdijb\nUFpu7CiOC0biGgNoWDTQ0ZnF/8et5qb/aRleLzfgkDx3eu7EnGiR5X8JnUm2\nLGFUkMPYakawV8E/0cE8TrnprV5k7qV1L6IRz5sBq6w+YymgeSgvqBQd+zah\n9Hg71sLpZR8HQEXL41j9dv1RBY050AaA/DrauBVTX2V2pN+palfdLRRZ4k+r\nTBIH3/8r9EWatS1LLdWd7NkigIf0hvZGU4roIKlEm424OXtwV6UiwSaiooY6\nyismbQNSs4JbcO57YJgfXbYS4d4RlqDN6C4NsATCFgGeQgTtTmhoENiJ66qn\nkdb/WYmnH7ozp4dHv+0sxtlyaVdIHL/9M7S4ValU9Fg9+7RjpK34eT4e+Dk/\nuw1nQD7lT6aSBwoTjKBag3+ctBe4Jl8BqgpiKweDGkNTHVQZb7+K6h2I2FkG\nFlVx\r\n=jC0W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"d88178bc0d3aeb3a2740d335448141ea7de6e709","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","@babel/runtime":"^7.1.5"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.2_1541614978725_0.7238633086432158","host":"s3://npm-registry-packages"}},"1.2.3":{"name":"@redsift/js-lib-google-analytics","version":"1.2.3","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.2.3","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"77fcfdf1940566c7abf4816c3abb567ff7a5c73a","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.2.3.tgz","fileCount":15,"integrity":"sha512-mVNF3Dxjdog7t8cVGpJIKqy/5oDzcyZmS6YugeHbf/4tdI1UoiuXdJJHtWMhLKPf7fN44YI3fB3npKhrqt3DFw==","signatures":[{"sig":"MEYCIQCQ3IuD6kn66NyOYPS4HfPuk9iCZxH0jzZGkpD7YoncRAIhANLFuOx3QcqFpOl+QJKkLBjFb2mnVd+5ZZxEnhhEmV+F","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":407202,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5ASYCRA9TVsSAnZWagAAfdAP/0QREIGh37AIsBtxQaSg\nA3PHky7RDpoFHJYOVUmSyGJa2nJbauiax+eoM32TZraKtsLdzg9m6a8LaZER\nblJZME/aF6n5ev8PddIu1MIUdFaKttT9KV52EFYLP0APJCJGIFHRbZqqZDvz\nEO9WMXv4uPZcu7/GbtfY6yySkB00jrQkx/mpBveWjuGd1zZMPE3046TrI23a\nC5MtZHIkf9mvwH6d9g2CFlYmRekkFhSsc87gxbxohKo8xngRcdnl2c47s6h6\nnJ9aXW6ZC95I44/xjfYse8s4MsHPU6MFbc2GvIaZYlEvysYkiuEGfqr3AMlq\nznQKEVcbZqqT7u6yqVBwkBO1tPShGlbjrBIqhZ564hbN2dsZkLsnLpRY2XFp\nwwvTpbJWu7ZkjjRYnElasTG7GeUVnRO2ETvk7bwvqHe+ty3b3IzRBZfZ2Z4l\nTVqYB643ak+WPNcpmYc1J+AeECSD4H9UAOV58jDKqi5EJhkoeOVDfhiMELk3\nJlBW/h9AP/ao0WN3caRjXs37DxyuqxQOSBselk4M7V4oCs0PzAcGmgMyvhsl\nWu9lli+gN6SobHmXaNymL5SMKhAzwxaxR3CvI6tv2FgLhqxCTFffGznDf/Vh\n8LG9+wJkcqqec/truR2RwCN5XXmPzvSsQJyMsknmYzTk3Pt8htFGq4lBr+rb\nars6\r\n=bEQ/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"ac1160d2a1967e8ab5bd573d08d62794402dbbd5","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"6.2.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.1","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","@babel/runtime":"^7.1.5"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.2.3_1541670040085_0.6477196625649235","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@redsift/js-lib-google-analytics","version":"1.3.0","keywords":["google","ga","analytics"],"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","_id":"@redsift/js-lib-google-analytics@1.3.0","maintainers":[{"name":"chrisvo","email":"christos@redsift.io"},{"name":"deepakp","email":"deepak@redsift.io"},{"name":"eliasg523","email":"elias@redsift.io"},{"name":"gdancc","email":"dcrawford@kx.com"},{"name":"idkwaev","email":"peter@redsift.io"},{"name":"jrans","email":"jwrans@gmail.com"},{"name":"martinhecher","email":"martin@redsift.io"},{"name":"mnolan","email":"mnolan@kx.com"},{"name":"rahulpowar","email":"rahul@redsift.io"},{"name":"randalpinto","email":"randal@redsift.io"}],"dist":{"shasum":"d818e53223da9bfaaefe0a3e85b3007afe7bbd6a","tarball":"https://registry.npmjs.org/@redsift/js-lib-google-analytics/-/js-lib-google-analytics-1.3.0.tgz","fileCount":17,"integrity":"sha512-mOlgZCSgynyg7/UQvc+eOdM/p9aGo4QpTynJ6dAbbicokYXKijw/pCLftbsDT8dhjrjCI/6nZV8Q2jmcXu9Gwg==","signatures":[{"sig":"MEQCIDPPMOBllKztL/0d5Z7EhfuBm6WhCegArOPapkrlFi7SAiBBxxcIxNw7eJduUVpkV4qYS1Zj5+8gRz7YWBFkfP4yjg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":410081,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5CAyCRA9TVsSAnZWagAARCgP/1WBNfYYD5UWT9BFFuPY\nrium0YfP1AfgzRj9kP2bonVeThWOCjH8BwSsm8WTD1mmXK/aRbPQBl5k/LrP\ncpzzowlOBJOSOXBW73gHscEpJWr4woIb2Ax+SSgCY4VXprQEi30d2CJwdqSQ\nGe/SkWTFx6ZS4nDvfA/ZgWkdwqlO1m+QsA6RJiphGQCgaAFxnXow5i5At5hI\njRID/C9u/X4IGJ71qGecuh4dZdaB9olzuDBAN8lhJWvG5XCBRc4aAm/U1ArX\naAiWOxMuhar5sUA3azO6LAvnGx/oBdiDA3jlrzoWwhlU4mP7Xa6juI9I92pZ\nCbsDkXODtAPiJM+H+SxU9CCY+E9XqeCc3E/wyfJhXsLcuBh8gmhZKOV0tQ34\na3EbqCWGyVRh+xMXbvfG259IccjmjNfyNbiDTd7K2+EpVsbKydD7Iy1bZKyX\ne3+AsqRtcCwtDMGWs0Xg8zskT3uJmS1j5hqexCgXQ2fAt4LUi9GJ4XiX3lob\n1ahi0fG2LSjDFQfeHGdwcj/qVVY0ZZqKPEvLN1sS8ztRMcEFx0VWqQRN+Cnl\nvdaARFONAAIHHQTBXHffefER+Z4UFzXv4+6fi2Ohqpxzo0QdgmGDkQebYSWl\nJ8w2XZEaunJuFTNbh7dFjVcqoFKHIwqbKfhQNEduwBqfEbEqr/q8hnpNDBD1\nLVTD\r\n=0cLl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/js-lib-google-analytics.umd.min.js","esnext":"src/index.js","module":"dist/js-lib-google-analytics.esm.js","browser":"dist/js-lib-google-analytics.umd.min.js","gitHead":"1bf5a9239273d143759aebfd8f8e3e9f65401209","scripts":{"test":"npm run build && jest --notify","build":"rollup-bundler","test:watch":"jest --watch","prepublishOnly":"npm test"},"_npmUser":{"name":"martinhecher","email":"martin@redsift.io"},"_npmVersion":"5.6.0","description":"Setup Google Analytics with cross-linked projects and more.","directories":{},"jsnext:main":"dist/js-lib-google-analytics.esm.js","_nodeVersion":"8.11.3","dependencies":{"@redsift/rollup-bundler":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^23.6.0","@babel/runtime":"^7.1.5"},"_npmOperationalInternal":{"tmp":"tmp/js-lib-google-analytics_1.3.0_1541677105987_0.1469408891711117","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-11-05T16:42:03.593Z","modified":"2026-09-15T11:14:06.671Z","1.0.3":"2018-11-05T16:42:03.883Z","1.1.0-beta-0":"2018-11-06T15:11:40.195Z","1.1.0-beta-2":"2018-11-06T16:41:16.948Z","1.1.0":"2018-11-06T17:25:55.320Z","1.1.1":"2018-11-06T17:38:44.181Z","1.1.2":"2018-11-06T18:09:30.740Z","1.2.0-beta-0":"2018-11-07T11:20:11.490Z","1.2.0-beta-1":"2018-11-07T11:41:27.894Z","1.2.0-beta-2":"2018-11-07T11:45:04.632Z","1.2.0":"2018-11-07T14:09:37.182Z","1.2.1":"2018-11-07T14:35:38.306Z","1.2.2-beta-0":"2018-11-07T16:26:52.694Z","1.2.2":"2018-11-07T18:22:58.900Z","1.2.3":"2018-11-08T09:40:40.217Z","1.3.0":"2018-11-08T11:38:26.118Z"},"author":{"name":"Martin Hecher","email":"martin@redsift.io"},"license":"ISC","keywords":["google","ga","analytics"],"description":"Setup Google Analytics with cross-linked projects and more.","maintainers":[{"email":"operations@redsift.io","name":"redsift_operations"},{"email":"rahul@redsift.io","name":"rahulpowar"},{"email":"randal@redsift.io","name":"randalpinto"},{"email":"nicolas.jaremek@redsift.io","name":"njaremek"},{"email":"eduardo.arada@redsift.io","name":"earada"},{"email":"jose.cabrera@redsift.io","name":"jmccanal"},{"email":"bernat.mayolas@redsift.io","name":"bmayolasredsift"},{"email":"raul.lorenzo@redsift.io","name":"raul.lorenzo.redsift"},{"email":"pidupuis@protonmail.com","name":"pierredupuis"},{"email":"caluminus@hotmail.co.uk","name":"luminous_cal"},{"email":"hector.ortega@redsift.io","name":"hortega_rs"},{"email":"asim.gunes@smartbee.uk","name":"asimgunes"},{"email":"dmitry@redsift.io","name":"sometimesitbetterstepasideandnotusejavascript"},{"email":"serhii.trofimenko@redsift.io","name":"sega057"},{"email":"julian.picht@redsift.io","name":"julian.picht"},{"email":"pedro.jimenez@redsift.io","name":"pedro.lop.j"},{"email":"anne.shackelford@redsift.io","name":"anneshackeford"},{"email":"piero.nima@redsift.io","name":"pieronima"},{"email":"bhushan.lokhande@redsift.io","name":"bhushan-redsift"},{"email":"mike.cardwell@redsift.io","name":"mikehardenize"},{"email":"jay.singh@redsift.io","name":"jaydsingh11"},{"email":"antony.seedhouse@redsift.io","name":"synotnars"},{"email":"nadim.lahoud@redsift.io","name":"lahoud"},{"email":"juan.baquero@redsift.io","name":"jmbaquero_redsift"}],"readme":"# js-lib-google-analytics\n\n`js-lib-google-analytics` is a helper library to setup Google Analytics via [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/). It provides:\n\n* Setup for sending of events to a single or multiple Google Analytics projects.\n* Setup of [cross domain linking](https://support.google.com/analytics/answer/1034342?hl=en).\n* Allows to enable [IP anonimization](https://developers.google.com/analytics/devguides/collection/analyticsjs/ip-anonymization).\n* Optional configuration for the `autotrack.js` plugins `cleanUrlTracker`, `pageVisibilityTracker` and `urlChangeTracker`.\n\n## Setup\n\n### Prerequisites: analytics.js and (optionally) autotrack.js\n\n[analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs/) is Google's official tracking library, providing the global `ga` object which this repository helps to configure. Please use [the installation instructions](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to setup `analytics.js`.\n\nOptionally you can install the [autotrack.js](https://github.com/googleanalytics/autotrack) library, which, according to its Github repository, does *\"Automatic and enhanced Google Analytics tracking for common user interactions on the web.\"*. Check the repository documentation for more information and see the next step on how to configure a selection of `autotrack` plugins via `js-lib-google-analytics`.\n\n### Usage\n\n### Default usage\n\nTo use the default configuration which comes with the library use the following code:\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\nUsing `getDefaultProjectSetup()` yields this configuration:\n\n```javascript\n{\n    anonymizeIp: true, // enable IP anonimization\n    cookieName: '_ga',\n    anonymizeIp: true,\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId\n    userId: null, // if set the `userId` will be set for the tracker, see https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference?hl=en#clientId\n    clientId: null,\n    autoLink: [], // don't configure cross domain linking \n    sendInitialPageView: true, // send an initial page view when using `setupGoogleAnalytics()`\n    autoTrack: {\n      // configure the `cleanUrlTracker` autotrack plugin with this configuration\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/clean-url-tracker.md        \n      cleanUrlTracker: {\n        stripQuery: true,\n        queryDimensionIndex: 1,\n        indexFilename: 'index.html',\n        trailingSlash: 'remove',\n      },\n      // enable the `urlChangeTracker` autotrack plugin\n      // see https://github.com/googleanalytics/autotrack/blob/master/docs/plugins/url-change-tracker.md#differentiating-between-virtual-pageviews-and-the-initial-pageview\n      urlChangeTracker: true, // configure the `urlChangeTracker` autotrack plugin with this configuration\n    },\n}\n```\n\nYou can use this configuration as a base for your own customization.\n\n> NOTE: If you don't provide a `name` property to the config the tracker name will be derived from the `uaProjectId` in removing all `-`.\n\n### Sending events to multiple projects\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst configs = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(configs);\n```\n\nThis will send events to each configured projects. A use case is to have a GA project which only collects events for a single domain, and a second project which collects events from all your domains, including the one you are using `@redsift/js-lib-google-analytics` for (in this case it is useful to setup cross domain linking, see below).\n\n### Cross domain linking\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoLink: ['blog.myproject.at', 'docs.myproject.at'],\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide pageview and URL information for the domains referenced in `autoLink` in the `UA-PROJECT-ID` project.\n\n### Usage without `autotrack.js`\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    autoTrack: null,\n};\n\nsetupGoogleAnalytics(config);\n```\n\nThis will provide setup `analytics.js` but will skip the configuration of `autotrack.js`.\n\n### Trigger events for all configured projects\n\nAfter you called `setupGoogleAnalytics()` you can send events to all of them with a single command. Please note that this command only supportes 3 parameters max:\n\n```javascript\nimport setupGoogleAnalytics, { gaAll } from '@redsift/js-lib-google-analytics';\n\n// ... setup you projects\n\ngaAll('send', 'pageview'); // Sends a pageview event to all configured projects.\n```\n\n### Configure a session based cookie (which immediately expires)\n\nSee https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#cookie_expiration for more information.\n\nTo create a permanent cookie after initializing the session based on you can call `setupGoogleAnalytics()` without the `temporarySession` config parameter. The `clientId` for the cookie will stay the same in this case, so your GA project will treat the two sessions as the same user.\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup } from '@redsift/js-lib-google-analytics';\n\nconst temporarySessionConfig = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n    temporarySession: true,\n};\n\nsetupGoogleAnalytics(temporarySessionConfig);\n\n// To make the cookie permanent call the setup function again without `temporarySession`:\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n```\n\n### Get a list of the configured project names\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = [{\n    uaProjectId: 'UA-PROJECT-ID-0',\n    ...getDefaultProjectSetup(),\n}, {\n    uaProjectId: 'UA-PROJECT-ID-1',\n    ...getDefaultProjectSetup(),\n}];\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // Returns a Set of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n\nconsole.log(getProjectNames({ asArray: true })); // Returns an Array of project names, here: ['UA-PROJECT-ID-0' 'UA-PROJECT-ID-1']\n```\n\n### Set a custom project name for the tracker\n\n```javascript\nimport setupGoogleAnalytics, { getDefaultProjectSetup, getProjectNames } from '@redsift/js-lib-google-analytics';\n\nconst config = {\n    uaProjectId: 'UA-PROJECT-ID-0',\n    name: 'MyTracker',\n    ...getDefaultProjectSetup(),\n};\n\nsetupGoogleAnalytics(config);\n\nconsole.log(getProjectNames()); // ['MyTracker']\n```","readmeFilename":"README.md"}