Screen tracking
Screen hits can be sent using the screenview
method.
By passing a string it will track the page by sending a screenview event with the string as screenName property.
export default {
name: 'MyComponent',
methods: {
track () {
this.$ga.screenview('home')
}
}
}
it is also possible to pass an object literal to fully customize the event
export default {
name: 'MyComponent',
methods: {
track () {
this.$ga.screenview({
screenName: 'home',
... // other properties
})
}
}
}
Screen autotracking
It is also possible to use autotracking and screen tracking by passing true to the screeview
property in the autoTracking
object
import Vue from 'vue'
import VueAnalytics from 'vue-analytics'
Vue.use(VueAnalytics, {
id: 'UA-XXX-X',
autoTracking: {
screenview: true
}
})
Route name property is mandatory
当前内容版权归 vue-analytics 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 vue-analytics .