|
| 1 | +# nuxt-segment-analytics |
| 2 | + |
| 3 | +[![David-DM][david-dm-src]][david-dm-href] |
| 4 | +[![Standard JS][standard-js-src]][standard-js-href] |
| 5 | +[![Circle CI][circle-ci-src]][circle-ci-href] |
| 6 | +[![Codecov][codecov-src]][codecov-href] |
| 7 | +[![npm version][npm-version-src]][npm-version-href] |
| 8 | +[![npm downloads][npm-downloads-src]][npm-downloads-href] |
| 9 | + |
| 10 | +> NuxtJS module for Stripe.js |
| 11 | +
|
| 12 | +[📖 **Release Notes**](./CHANGELOG.md) |
| 13 | + |
| 14 | +This module uses [vue-segment-analytics](https://github.com/Kapiche/vue-segment-analytics) to add Segment Analytics to a Nuxt.js app. |
| 15 | +You can make called with this.$analytics.track() |
| 16 | + |
| 17 | +## Setup |
| 18 | + |
| 19 | +- Add `nuxt-segment-analytics` dependency using yarn or npm to your project |
| 20 | +- Add `nuxt-segment-analytics` to `modules` section of `nuxt.config.js` |
| 21 | + |
| 22 | +## Usage |
| 23 | +### nuxt.config.js |
| 24 | +```js |
| 25 | +{ |
| 26 | + modules: [ |
| 27 | + // Simple usage |
| 28 | + 'nuxt-segment-analytics', |
| 29 | + |
| 30 | + // With options |
| 31 | + ['nuxt-segment-analytics', { id: "SEGMENT_KEY", useRouter: true }], |
| 32 | + ] |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +### YourComponent.vue |
| 37 | +```js |
| 38 | +export default { |
| 39 | + mounted () { |
| 40 | + this.$analytics.identify('f4ca124298', { |
| 41 | + name: 'Michael Bolton', |
| 42 | + email: 'mbolton@initech.com' |
| 43 | + }) |
| 44 | + this.$analytics.track('Signed Up', { plan: 'Enterprise' }) |
| 45 | + this.$analytics.page('Pricing'); |
| 46 | + } |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | + |
| 51 | +## Development |
| 52 | + |
| 53 | +- Clone this repository |
| 54 | +- Install dependencies using `yarn install` or `npm install` |
| 55 | +- Start development server using `npm run dev` |
| 56 | + |
| 57 | +## License |
| 58 | + |
| 59 | +[MIT License](./LICENSE) |
| 60 | + |
| 61 | +Copyright (c) Dylan Wight <dylan@otechie.com> |
| 62 | + |
| 63 | +<!-- Badges --> |
| 64 | +[david-dm-src]: https://david-dm.org/https://github.com/dgwight/nuxt-segment-analytics/status.svg?style=flat-square |
| 65 | +[david-dm-href]: https://david-dm.org/https://github.com/dgwight/nuxt-segment-analytics |
| 66 | +[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square |
| 67 | +[standard-js-href]: https://standardjs.com |
| 68 | +[circle-ci-src]: https://img.shields.io/circleci/project/github/https://github.com/dgwight/nuxt-segment-analytics.svg?style=flat-square |
| 69 | +[circle-ci-href]: https://circleci.com/gh/https://github.com/dgwight/nuxt-segment-analytics |
| 70 | +[codecov-src]: https://img.shields.io/codecov/c/github/https://github.com/dgwight/nuxt-segment-analytics.svg?style=flat-square |
| 71 | +[codecov-href]: https://codecov.io/gh/https://github.com/dgwight/nuxt-segment-analytics |
| 72 | +[npm-version-src]: https://img.shields.io/npm/dt/nuxt-segment-analytics.svg?style=flat-square |
| 73 | +[npm-version-href]: https://npmjs.com/package/nuxt-segment-analytics |
| 74 | +[npm-downloads-src]: https://img.shields.io/npm/v/nuxt-segment-analytics/latest.svg?style=flat-square |
| 75 | +[npm-downloads-href]: https://npmjs.com/package/nuxt-segment-analytics |
0 commit comments