{"_id":"@analytics/churn-zero","_rev":"1-8e2daab36a2cce61bcad89102caa4a69","name":"@analytics/churn-zero","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@analytics/churn-zero","version":"0.0.1","keywords":["analytics","analytics-project","analytics-plugin","churn-zero"],"author":{"name":"Ahmed Onawale","email":"atolagbeabisoye@gmail.com"},"license":"MIT","_id":"@analytics/churn-zero@0.0.1","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"homepage":"https://github.com/DavidWells/analytics#readme","bugs":{"url":"https://github.com/DavidWells/analytics/issues"},"dist":{"shasum":"162978d36515eb844ecfe083cb9fa3244c0f8844","tarball":"https://registry.npmjs.org/@analytics/churn-zero/-/churn-zero-0.0.1.tgz","fileCount":8,"integrity":"sha512-hEzTwDkqtbH4ngdE8Sb7vmhv+GY/AM+EblydNeH9YXiyc4km2vtIhS4qG5abmQ+MPPBU9lQI2aZfvl8AZWwhQg==","signatures":[{"sig":"MEUCIGz/P+yKnKT8yq7Vfgw4gwhXWTImp2zT5kADeYGAbVZlAiEA3CIXEvxvCZzs/WyW3A1mOXg9ENOt/YqZMfCCA3LNVn4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29658},"main":"lib/analytics-plugin-churn-zero.cjs.js","module":"lib/analytics-plugin-churn-zero.es.js","browser":{"./lib/analytics-plugin-churn-zero.es.js":"./lib/analytics-plugin-churn-zero.browser.es.js","./lib/analytics-plugin-churn-zero.cjs.js":"./lib/analytics-plugin-churn-zero.browser.cjs.js"},"gitHead":"ed7cb64f68bfc26303cce86fe879ea0cf6c88876","scripts":{"es":"../../node_modules/.bin/babel-node ./testBabel.js","docs":"node ../analytics-cli/bin/run docs","build":"node ../../scripts/build/index.js","watch":"node ../../scripts/build/_watch.js","release:major":"npm version major && npm publish","release:minor":"npm version minor && npm publish","release:patch":"npm version patch && npm publish"},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"globalName":"analyticsChurnzero","repository":{"url":"git+https://github.com/DavidWells/analytics.git","type":"git"},"_npmVersion":"8.19.4","description":"Churnzero integration for 'analytics' module for browser & node","directories":{},"jsnext:main":"lib/analytics-plugin-churn-zero.es.js","projectMeta":{"provider":{"url":"https://www.churnzero.com/","name":"ChurnZero"},"platforms":{"node":"./src/node.js","browser":"./src/browser.js"}},"_nodeVersion":"16.20.2","dependencies":{"unfetch":"^4.2.0"},"_hasShrinkwrap":false,"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.3.1"},"_npmOperationalInternal":{"tmp":"tmp/churn-zero_0.0.1_1733954823309_0.620911074569271","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@analytics/churn-zero","version":"0.0.2","description":"Churnzero integration for 'analytics' module for browser & node","projectMeta":{"provider":{"name":"ChurnZero","url":"https://www.churnzero.com/"},"platforms":{"browser":"./src/browser.js","node":"./src/node.js"}},"keywords":["analytics","analytics-project","analytics-plugin","churn-zero"],"author":{"name":"Ahmed Onawale","email":"atolagbeabisoye@gmail.com"},"license":"MIT","scripts":{"docs":"node ../analytics-cli/bin/run docs","build":"node ../../scripts/build/index.js","watch":"node ../../scripts/build/_watch.js","release:patch":"npm version patch && npm publish","release:minor":"npm version minor && npm publish","release:major":"npm version major && npm publish","es":"../../node_modules/.bin/babel-node ./testBabel.js"},"main":"lib/analytics-plugin-churn-zero.cjs.js","globalName":"analyticsChurnzero","jsnext:main":"lib/analytics-plugin-churn-zero.es.js","module":"lib/analytics-plugin-churn-zero.es.js","browser":{"./lib/analytics-plugin-churn-zero.cjs.js":"./lib/analytics-plugin-churn-zero.browser.cjs.js","./lib/analytics-plugin-churn-zero.es.js":"./lib/analytics-plugin-churn-zero.browser.es.js"},"homepage":"https://github.com/DavidWells/analytics#readme","repository":{"type":"git","url":"git+https://github.com/DavidWells/analytics.git"},"devDependencies":{"@babel/core":"^7.2.2","@babel/preset-env":"^7.3.1"},"dependencies":{"unfetch":"^4.2.0"},"gitHead":"8730d1b0e462f7bd2ae1b4cadd175c166ea5ffef","bugs":{"url":"https://github.com/DavidWells/analytics/issues"},"_id":"@analytics/churn-zero@0.0.2","_nodeVersion":"16.20.2","_npmVersion":"lerna/3.22.1/node@v16.20.2+arm64 (darwin)","dist":{"integrity":"sha512-W/rZu/RBOHKr7XCBYhyzgggr1kEOVwJTYPvXd4BZWJE9AO7w/Urk3q/0IRgMi5O9F1aztCejg3JXrjFbUxNEVw==","shasum":"ab7521476371a61303121f7050a1f8b6741a5590","tarball":"https://registry.npmjs.org/@analytics/churn-zero/-/churn-zero-0.0.2.tgz","fileCount":10,"unpackedSize":31357,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGf3bX9Ua/rlQiZwoPgan5OfsrF0x2ip20huCgIanEcfAiB0neW7Y2D+t8xLEZW19nRLb6cBo2CmYfrLmgIeZmAAAQ=="}]},"_npmUser":{"name":"davidwells","email":"davidgregorywells@gmail.com"},"directories":{},"maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/churn-zero_0.0.2_1733954926291_0.19473371499125958"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-11T22:07:03.178Z","modified":"2024-12-11T22:08:46.680Z","0.0.1":"2024-12-11T22:07:03.476Z","0.0.2":"2024-12-11T22:08:46.502Z"},"bugs":{"url":"https://github.com/DavidWells/analytics/issues"},"author":{"name":"Ahmed Onawale","email":"atolagbeabisoye@gmail.com"},"license":"MIT","homepage":"https://github.com/DavidWells/analytics#readme","keywords":["analytics","analytics-project","analytics-plugin","churn-zero"],"repository":{"type":"git","url":"git+https://github.com/DavidWells/analytics.git"},"description":"Churnzero integration for 'analytics' module for browser & node","maintainers":[{"name":"davidwells","email":"davidgregorywells@gmail.com"}],"readme":"<!--\ntitle: ChurnZero\ndescription: Using the ChurnZero analytics plugin\n-->\n# ChurnZero plugin for `analytics`\n\nIntegration with ChurnZero for [analytics](https://www.npmjs.com/package/analytics)\n\nThis analytics plugin will load ChurnZero's client side tracking script into your application and send custom events, page views, and identify visitors inside ChurnZero.\n\n[View the docs](https://getanalytics.io/plugins/churn-zero/)\n\n<!-- AUTO-GENERATED-CONTENT:START (TOC:collapse=true&collapseText=Click to expand) -->\n<details>\n<summary>Click to expand</summary>\n\n- [Installation](#installation)\n- [How to use](#how-to-use)\n- [Platforms Supported](#platforms-supported)\n- [Browser usage](#browser-usage)\n  - [Browser API](#browser-api)\n  - [Configuration options for browser](#configuration-options-for-browser)\n- [Server-side usage](#server-side-usage)\n  - [Server-side API](#server-side-api)\n  - [Configuration options for server-side](#configuration-options-for-server-side)\n- [Additional examples](#additional-examples)\n\n</details>\n<!-- AUTO-GENERATED-CONTENT:END (TOC) -->\n\n## Installation\n\nInstall `analytics` and `@analytics/churn-zero` packages\n\n```bash\nnpm install analytics\nnpm install @analytics/churn-zero\n```\n\n<!-- AUTO-GENERATED-CONTENT:START (PLUGIN_DOCS) -->\n\n## How to use\n\nThe `@analytics/churn-zero` package works in [the browser](#browser-usage) and [server-side in Node.js](#server-side-usage). To use, install the package, include in your project and initialize the plugin with [analytics](https://www.npmjs.com/package/analytics).\n\nBelow is an example of how to use the browser plugin.\n\n```js\nimport Analytics from 'analytics'\nimport churnZeroPlugin from '@analytics/churn-zero'\n\nconst analytics = Analytics({\n  app: 'awesome-app',\n  plugins: [\n    // This will load crazy egg on to the page\n    churnZeroPlugin({\n      accountId: '1234578'\n    })\n  ]\n})\n\n/* Track a page view */\nanalytics.page()\n\n/* Track a custom event */\nanalytics.track('cartCheckout', {\n  item: 'pink socks',\n  price: 20\n})\n\n/* Identify a visitor */\nanalytics.identify('user-id-xyz', {\n  firstName: 'bill',\n  lastName: 'murray'\n})\n\n```\n\nAfter initializing `analytics` with the `churnZeroPlugin` plugin, data will be sent into ChurnZero whenever [analytics.page](https://getanalytics.io/api/#analyticspage), [analytics.track](https://getanalytics.io/api/#analyticstrack), or [analytics.identify](https://getanalytics.io/api/#analyticsidentify) are called.\n\nSee [additional implementation examples](#additional-examples) for more details on using in your project.\n\n## Platforms Supported\n\nThe `@analytics/churn-zero` package works in [the browser](#browser-usage) and [server-side in Node.js](#server-side-usage)\n\n## Browser usage\n\nThe ChurnZero client side browser plugin works with these analytic api methods:\n\n- **[analytics.identify](https://getanalytics.io/api/#analyticsidentify)** - Identify visitors and send details to ChurnZero\n- **[analytics.page](https://getanalytics.io/api/#analyticspage)** - Sends page views into ChurnZero\n- **[analytics.track](https://getanalytics.io/api/#analyticstrack)** - Track custom events and send to ChurnZero\n\n### Browser API\n\n```js\nimport Analytics from 'analytics'\nimport churnZeroPlugin from '@analytics/churn-zero'\n\nconst analytics = Analytics({\n  app: 'awesome-app',\n  plugins: [\n    // This will load crazy egg on to the page\n    churnZeroPlugin({\n      accountId: '1234578'\n    })\n  ]\n})\n\n```\n\n### Configuration options for browser\n\n| Option | description |\n|:---------------------------|:-----------|\n| `accountId` <br/>**required** - string| ChurnZero account ID |\n| `scriptInclude` <br/>_optional_ - boolean| Load ChurnZero script into page |\n| `options` <br/>_optional_ - object| ChurnZero script options |\n\n## Server-side usage\n\nThe ChurnZero server-side node.js plugin works with these analytic api methods:\n\n- **[analytics.page](https://getanalytics.io/api/#analyticspage)** - Sends page views into ChurnZero\n- **[analytics.track](https://getanalytics.io/api/#analyticstrack)** - Track custom events and send to ChurnZero\n- **[analytics.identify](https://getanalytics.io/api/#analyticsidentify)** - Identify visitors and send details to ChurnZero\n\n### Server-side API\n\n```js\nimport Analytics from 'analytics'\nimport churnZeroPlugin from '@analytics/churn-zero'\n\nconst analytics = Analytics({\n  app: 'awesome-app',\n  plugins: [\n    churnZeroPlugin({\n      apiKey: 'abc123'\n    })\n  ]\n})\n\n```\n\n### Configuration options for server-side\n\n| Option | description |\n|:---------------------------|:-----------|\n| `apiKey` <br/>**required** - string| ChurnZero API key |\n\n\n## Additional examples\n\nBelow are additional implementation examples.\n\n<details>\n  <summary>Server-side ES6</summary>\n\n  ```js\n  import Analytics from 'analytics'\n  import churnZeroPlugin from '@analytics/churn-zero'\n\n  const analytics = Analytics({\n    app: 'awesome-app',\n    plugins: [\n      churnZeroPlugin({\n        apiKey: 'abc123'\n      })\n      // ...other plugins\n    ]\n  })\n\n  /* Track a page view */\n  analytics.page()\n\n  /* Track a custom event */\n  analytics.track('cartCheckout', {\n    item: 'pink socks',\n    price: 20\n  })\n\n  /* Identify a visitor */\n  analytics.identify('user-id-xyz', {\n    firstName: 'bill',\n    lastName: 'murray'\n  })\n\n  ```\n\n</details>\n\n<details>\n  <summary>Server-side Node.js with common JS</summary>\n\n  If using node, you will want to import the `.default`\n\n  ```js\n  const analyticsLib = require('analytics').default\n  const churnZeroPlugin = require('@analytics/churn-zero').default\n\n  const analytics = analyticsLib({\n    app: 'my-app-name',\n    plugins: [\n      churnZeroPlugin({\n        apiKey: 'abc123'\n      })\n    ]\n  })\n\n  /* Track a page view */\n  analytics.page()\n\n  /* Track a custom event */\n  analytics.track('cartCheckout', {\n    item: 'pink socks',\n    price: 20\n  })\n\n  /* Identify a visitor */\n  analytics.identify('user-id-xyz', {\n    firstName: 'bill',\n    lastName: 'murray'\n  })\n\n  ```\n\n</details>\n\n<details>\n  <summary>Using in HTML</summary>\n\n  Below is an example of importing via the unpkg CDN. Please note this will pull in the latest version of the package.\n\n  ```html\n  <!DOCTYPE html>\n  <html>\n    <head>\n      <title>Using @analytics/churn-zero in HTML</title>\n      <script src=\"https://unpkg.com/analytics/dist/analytics.min.js\"></script>\n      <script src=\"https://unpkg.com/@analytics/churn-zero/dist/@analytics/churn-zero.min.js\"></script>\n      <script type=\"text/javascript\">\n        /* Initialize analytics */\n        var Analytics = _analytics.init({\n          app: 'my-app-name',\n          plugins: [\n            // This will load crazy egg on to the page\n            analyticsChurnZero({\n              accountId: '1234578'\n            })\n          ]\n        })\n\n        /* Track a page view */\n        analytics.page()\n\n        /* Track a custom event */\n        analytics.track('cartCheckout', {\n          item: 'pink socks',\n          price: 20\n        })\n\n        /* Identify a visitor */\n        analytics.identify('user-id-xyz', {\n          firstName: 'bill',\n          lastName: 'murray'\n        })\n      </script>\n    </head>\n    <body>\n      ....\n    </body>\n  </html>\n\n  ```\n\n</details>\n\n<details>\n  <summary>Using in HTML via ES Modules</summary>\n\n  Using `@analytics/churn-zero` in ESM modules.\n\n  ```html\n  <!DOCTYPE html>\n  <html>\n    <head>\n      <title>Using @analytics/churn-zero in HTML via ESModules</title>\n      <script>\n        // Polyfill process.\n        // **Note**: Because `import`s are hoisted, we need a separate, prior <script> block.\n        window.process = window.process || { env: { NODE_ENV: 'production' } }\n      </script>\n      <script type=\"module\">\n        import analytics from 'https://unpkg.com/analytics/lib/analytics.browser.es.js?module'\n        import analyticsChurnZero from 'https://unpkg.com/@analytics/churn-zero/lib/analytics-plugin-churn-zero.browser.es.js?module'\n        /* Initialize analytics */\n        const Analytics = analytics({\n          app: 'analytics-html-demo',\n          debug: true,\n          plugins: [\n            // This will load crazy egg on to the page\n            analyticsChurnZero({\n              accountId: '1234578'\n            })\n            // ... add any other third party analytics plugins\n          ]\n        })\n\n        /* Track a page view */\n        analytics.page()\n\n        /* Track a custom event */\n        analytics.track('cartCheckout', {\n          item: 'pink socks',\n          price: 20\n        })\n\n        /* Identify a visitor */\n        analytics.identify('user-id-xyz', {\n          firstName: 'bill',\n          lastName: 'murray'\n        })\n      </script>\n    </head>\n    <body>\n      ....\n    </body>\n  </html>\n\n  ```\n\n</details>\n\n\n<!-- AUTO-GENERATED-CONTENT:END (PLUGIN_DOCS) -->\n","readmeFilename":"README.md"}