Event tracking
This module injects $ga
instance globally.
You can access the instance anywhere using:
this.$ga
within a componentcontext.$ga
for plugins,asyncData
,nuxtServerInit
and middleware
event()
The received parameters can be:
- Event
Object
contains:eventCategory
- the object that user interacted with.- Type:
String
required
- Type:
eventAction
- the type of interaction (click
,play
, etc.)- Type:
String
required
- Type:
eventLabel
- for categorizing events- Type:
String
- Type:
eventValue
- a numberic value associated with the event- Type:
Number
- Type:
this.$ga.event({
eventCategory: 'category',
eventAction: 'action',
eventLabel: 'label',
eventValue: 123
})
Or the Event's information can be spread directly as separate arguments, in the exact order
event(eventCategory, eventAction, eventLabel, eventValue)
For example:
this.$ga.event('category', 'action', 'label', 123)