Code Monkey home page Code Monkey logo

Comments (4)

awronski avatar awronski commented on May 18, 2024 1

@pi0 do you have any suggestion how to implement it?
Maybe I could do it and share.

from legacy-modules.

pi0 avatar pi0 commented on May 18, 2024

Hi @awronski . That would be nice if you are interested. I think we can access to route meta data for additional fields like analytics so page components can use analytics: { expId: 123 } to set that meta, then here we can conditionally check that field existance and setting all of them using ga('set'). Here is an example how nuxt accesses pages transition property.

from legacy-modules.

awronski avatar awronski commented on May 18, 2024

@pi0 I have this change almost working :)

The problem is that the router.afterEach((to, from) don't see to.meta.analytics for the first request.

For the following requests it is working ok. I set the meta in the middleware like this:

export default function ({ route, store }) {
  route.meta.analytics = {
    expId: 12345,
    expVar: Math.floor(Math.random() * 3) + 1
  }
}

How can I change it to work with the initialization too?

from legacy-modules.

pi0 avatar pi0 commented on May 18, 2024

@awronski We can access to first page on plugin load using router. So maybe we can refactor function inside afterEach and call it once again on plugin load. PS: Waiting for PR :D

from legacy-modules.

Related Issues (20)

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.