Set

Sets a single field and value pair or a group of field/value pairs on a tracker object.

  1. this.$ga.set(fieldName, fieldValue)

also possible to pass an object literal

  1. this.$ga.set({ fieldName: fieldValue })

Set multiple fields before first hit

Adding the set property to the configuration object, we can set multiple fields automatically before the first hit

  1. import Vue from 'vue'
  2. import VueAnalytics from 'vue-analytics'
  3. Vue.use(VueAnalytics, {
  4. id: 'UA-XXX-X',
  5. set: [
  6. { field: 'fieldname', value: 'fieldvalue' }
  7. ]
  8. })