Giter Site home page Giter Site logo

trackPage: false about gridsome-plugin-segment-js HOT 8 OPEN

 avatar commented on July 28, 2024
trackPage: false

from gridsome-plugin-segment-js.

Comments (8)

travis-r6s avatar travis-r6s commented on July 28, 2024

@jrpersico-spurred So you are calling the track function manually? Could you paste your code?

from gridsome-plugin-segment-js.

 avatar commented on July 28, 2024

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.

from gridsome-plugin-segment-js.

travis-r6s avatar travis-r6s commented on July 28, 2024

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.

from gridsome-plugin-segment-js.

 avatar commented on July 28, 2024

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

from gridsome-plugin-segment-js.

 avatar commented on July 28, 2024

Empty or always with the same value

from gridsome-plugin-segment-js.

travis-r6s avatar travis-r6s commented on July 28, 2024

Did you add https://www.github.com/thetre97/gridsome-plugin-segment-js/tree/master/gridsome.client.js#L22?

from gridsome-plugin-segment-js.

 avatar commented on July 28, 2024

Nope, finally I don't use the router...

I need to set different categories for each pages or templates...

Maybe you have a tip ?

from gridsome-plugin-segment-js.

travis-r6s avatar travis-r6s commented on July 28, 2024

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.

from gridsome-plugin-segment-js.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.