Open spurredio opened 4 years ago
@jrpersico-spurred So you are calling the track function manually? Could you paste your code?
Yes I do !
in templates/ContentfulBlogPost.vue
mounted () { this.$segment.page(this.$page.post.category, this.$page.post.title, { title: this.$metaInfo.title }) }
When I go to a post, no worries. But if I navigate from a post to another post with the same template, tracking doesn't run again.
Yes, that is probably because mounted hooks are not necessarily rerun on a page change, if the layout is exactly the same, but the content changes - using the same template for instance.
I suggest you instead use the router.afterEach
hook to fire the analytics tracking function. You can see an example of this in this plugins gridsome.client.js
.
Ok thank you I was able to fix the problem !
But unfortunately when trackPage is set to false, referrer is empty in segment...
Do you have any idea ?
Thanks
Empty or always with the same value
Nope, finally I don't use the router...
I need to set different categories for each pages or templates...
Maybe you have a tip ?
In that case, sorry, no - not sure how you can get the referrer otherwise. I don't believe it is available in the $route
property.
Firstly, thank for the plugin.
I have an issue. When i set trackPage: false, tracking page in templates only run once.
Do you know how i can run the page tracking each time i recall a template with a diferent path ?
BTW i've this error in devlopment : Error in mounted hook: "TypeError: Cannot read property 'page' of undefined"
Thanks in advance !