@@ -12,12 +12,12 @@ const install = function (Vue, initConf = {}) {
12
12
/*eslint-disable*/
13
13
// Load the analytics snippet
14
14
( function ( i , s , o , g , r , a , m ) {
15
- i [ 'GoogleAnalyticsObject' ] = r ;
16
- i [ r ] = i [ r ] || function ( ) {
17
- ( i [ r ] . q = i [ r ] . q || [ ] ) . push ( arguments )
18
- } , i [ r ] . l = 1 * new Date ( ) ;
15
+ i [ 'GoogleAnalyticsObject' ] = r ;
16
+ i [ r ] = i [ r ] || function ( ) {
17
+ ( i [ r ] . q = i [ r ] . q || [ ] ) . push ( arguments )
18
+ } , i [ r ] . l = 1 * new Date ( ) ;
19
19
a = s . createElement ( o ) ,
20
- m = s . getElementsByTagName ( o ) [ 0 ] ;
20
+ m = s . getElementsByTagName ( o ) [ 0 ] ;
21
21
a . async = 1 ;
22
22
a . src = g ;
23
23
m . parentNode . insertBefore ( a , m )
@@ -83,8 +83,11 @@ const initVueRouterGuard = function (Vue, vueRouter, ignoredViews, trackPage) {
83
83
return
84
84
}
85
85
86
- // Dispatch vue event using meta analytics value if defined otherwise fallback to route name
87
- Vue . analytics . trackView ( to . meta . analytics || to . name , trackPage )
86
+ // If specified : the system will use the path instead of the route name.
87
+ const viewName = to . meta . usePathAnalytics ? to . path : to . name
88
+
89
+ // Dispatch vue event using meta analytics value if defined otherwise fallback to route name/path.
90
+ Vue . analytics . trackView ( to . meta . analytics || viewName , trackPage )
88
91
} )
89
92
90
93
return ignoredViews
0 commit comments