Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 125462f

Browse files
fix(page): track previous page
adds back nextTick see nuxt-community/google-analytics-module/issues/8
1 parent cc858f7 commit 125462f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib/page.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function trackRoute (route) {
7979
}
8080

8181
export function autoTracking () {
82-
const { router, autoTracking } = config
82+
const { router, autoTracking, $vue } = config
8383

8484
if (!autoTracking.page || !router) {
8585
return
@@ -105,7 +105,10 @@ export function autoTracking () {
105105
return
106106
}
107107

108-
trackRoute(router.currentRoute)
108+
// see https://github.com/nuxt-community/analytics-module/issues/8
109+
$vue.nextTick().then(() => {
110+
trackRoute(router.currentRoute)
111+
})
109112
})
110113
})
111114
}

0 commit comments

Comments
 (0)