vue-segment
Vue plugin for Segment
Vue.js plugin for Segment
Segment Analytics.js Documentation
Requirements
Vue ^2.0.0
npm install @prestashopcorp/segment-vue
import Vue from 'vue'
import VueSegment from 'vue-segment'
Vue.use(VueSegment, {
id: 'XXXXX',
});
Identify
add this on your App.vue file
created(){
this.$segment.identify({shopId}, {
name: "FullName_account",
email: "email_account",
plan: "premium_account"
})
}
Track
add this on each method click
handleClick(){
this.$segment.track(NAME_YOUR_TRACK)
}
Options
Option Route track
put the name attribute in each route and add your router to the vue-segment initialization
export default {
path: "dashboard",
name: "dashboard",
component: DashboardApp,
};
Vue.use(VueSegment, {
id: 'XXXXX',
router
});
Option exclude route
export default {
name: "activity",
path: "activity",
meta: {exclude: true},
component: () =>
import(
"@/core/dashboard/pages/ActivityApp"
),
redirect: "activity/revenue",
children: [RevenueRouter, OrderRouter, ConversionRouter, VisitRouter],
};
Option Page Category
put the name attribute in each route and add your router to the vue-segment initialization
Vue.use(VueSegment, {
id: 'XXXXX',
router,
pageCategory: "ps_metrics_"
});