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.

  1. export default {
  2. name: 'MyComponent',
  3. methods: {
  4. track () {
  5. this.$ga.screenview('home')
  6. }
  7. }
  8. }

it is also possible to pass an object literal to fully customize the event

  1. export default {
  2. name: 'MyComponent',
  3. methods: {
  4. track () {
  5. this.$ga.screenview({
  6. screenName: 'home',
  7. ... // other properties
  8. })
  9. }
  10. }
  11. }

Screen autotracking

It is also possible to use autotracking and screen tracking by passing true to the screeview property in the autoTracking object

  1. import Vue from 'vue'
  2. import VueAnalytics from 'vue-analytics'
  3. Vue.use(VueAnalytics, {
  4. id: 'UA-XXX-X',
  5. autoTracking: {
  6. screenview: true
  7. }
  8. })

Route name property is mandatory