You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
debug:true, // Whether or not display console logs (optional)
38
+
appName:'<app_name>',// Mandatory
39
+
appVersion:'<app_version>',// Mandatory
40
+
trackingId:'<your_tracking_id>',// Mandatory
41
+
debug:true, // Whether or not display console logs debugs (optional)
42
42
vueRouter: router, // Pass the router instance to automatically sync with router (optional)
43
-
ignoredViews: ['homepage'], // If router, you can exclude some routes name (case insensitive)
44
-
globalDimensions: [
43
+
ignoredViews: ['homepage'], // If router, you can exclude some routes name (case insensitive) (optional)
44
+
globalDimensions: [// Optional
45
45
{dimension:1, value:'MyDimensionValue'},
46
46
{dimension:2, value:'AnotherDimensionValue'}
47
-
]
47
+
],
48
+
globalMetrics: [ // Optional
49
+
{metric:1, value:'MyMetricValue'},
50
+
{metric:2, value:'AnotherMetricValue'}
51
+
]
48
52
})
49
53
```
50
54
51
55
# Documentation
52
56
53
-
Once registered you can access vue analytics in your components like this :
57
+
Once the configuration is completed, you can access vue analytics instance in your components like that :
54
58
55
59
```javascript
56
60
exportdefault {
@@ -73,17 +77,35 @@ export default {
73
77
}
74
78
```
75
79
76
-
You can also access the instance everywhere using `Vue.analytics`, it's useful when you are in the store or somewhere else than components.
80
+
You can also access the instance anywhere whenever you imported `Vue` by using `Vue.analytics`. It is especially useful when you are in a store module or
81
+
somewhere else than a component's scope.
82
+
83
+
## Sync analytics with your router
84
+
85
+
Thanks to vue-router guards, you can automatically dispatch new screen views on router change !
86
+
To use this feature, you just need to inject the router instance on plugin initialization.
77
87
78
-
## Using vue-router guards
88
+
This feature will generate the view name according to a priority rule :
89
+
- If you defined a meta field for you route named `analytics` this will take the value of this field for the view name.
90
+
- Otherwise, if the plugin don't have a value for the `meta.analytics` it will fallback to the internal route name.
79
91
80
-
You can automatically dispatch new screen views on router change, to do this simply pass the router instance on plugin initialization.
81
-
At the moment, this is using the `route name` to name the HIT, but this is going to be updated to allow you to specify whatever values you wants.
92
+
Most of time the second case is enough, but sometimes you want to have more control on what is sent, this is where the first rule shine.
0 commit comments