Closed bnason closed 4 years ago
I am having the same problem. Any solution to this one?
I am having the same problem too. Any solution to this one?
same issue over here, will try some workarounds, though I think I may resort to "detecting" the title being wrong and not sending those tracks via the onBeforeTrack hooks or something?
I actually I think I found the issue. I was wrongly calling gtag once loaded but this library it's slightly different from analytics and I don't have to initialise trackers or stuff like this so I need to remove that part I thought was needed and add a trackPage
on Router.onReady
which will also call the custom template.
the onReady method returns the current route as callback so sounds like a deal
this is the fix basically
Router.onReady(current => {
trackPage(current);
Router.afterEach((to, from) => {
Vue.nextTick().then(() => {
onBeforeTrack(to, from);
trackPage(to, from);
onAfterTrack(to, from);
});
});
});
let me know if the fix worked
@bnason please a feedback would be super helpful to understand if this worked
@MatteoGabriele I've had a week off at work and I'll be checking this out monday in the AM.... I'll let you know how it goes! thanks for the effort on this and the quick turnaround.
alright, a co-worker has the upgrade in progress, will report back shortly!
Thanks a lot
unrelated issues kept us from making this change, i'll see if I can get it in first thing in the morning. thanks again for the project, documentation, and responsiveness
Description
Initial page loaded is being tracked incorrectly.
pageTrackerTemplate
is not being called.Expected behavior
When loading the site, I'd expect the tracking of the initial page to call
pageTrackerTemplate
to get my custom title value.Actual behavior
An event is sent with the actual document title which is not what I want to send. For example, my route.meta.title is set to 'Classes'. However, I have a
router.afterEach
hook that prepends 'Site Name | ' to it and sets document.title.Environment
Run this command in the project folder and fill in their results:
npm ls vue-gtag
: vue-gtag@1.6.2Then, specify:
Reproducible Demo