vue-segment
!npm versionnpm-version-srcnpm-version-href
!npm downloadsnpm-downloads-srcnpm-downloads-href
!Dependenciesdavid-dm-srcdavid-dm-href
!Standard JSstandard-js-srcstandard-js-hrefVue.js plugin for Segment Analytics.js
Segment Analytics.js Documentation
Setup
- Add the
@dansmaculotte/vue-segment
dependency withyarn
ornpm
to your project - Configure it:
import Vue from 'vue'
import Segment from '@dansmaculotte/vue-segment'
Vue.use(Segment, {
writeKey: 'YOUR_SEGMENT_WRITE_KEY',
disabled: true,
router,
pageCategory: 'shop',
settings: {
...
}
})
Usage
See Segment Vue Quickstart Guide.Options
writeKey
- Type:
String
''
disabled
Disable automatic script loading, if you need compliance with GDPR.- Type:
Boolean
false
router
Callanalytics.page
method on afterEach
router method if provided.- Type:
Object
pageCategory
In case you provided router, you can specify the category page of thepage
event. See segment page method reference.- Type:
String
,
''
settings
See Load options reference.- Type:
Object
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev