Send events from Vuex
See original GitHub issueHi @MatteoGabriele - firstly thank you for a fabulous plugin (also thank you for vue analytics)
This is just a quick query if I may.
Is it possible to send events or exceptions in my case from a Vuex module
I have a Vuex module in a file called auth.js and would like to send an exception to GA if an error happens in there, something along the lines of:
import { exception } from 'vue-gtag'
auth.checkSession((err, result) => {
if (err) {
exception({
'description': err,
'fatal': false
})
} else {
// . . . carry on
}
})
I can’t seem to get to work though am I doing something wrong or hasn’t this been implemented (I haven’t seen it in the docs so I’m guessing the latter) - if not implemented is there a way I can get to work?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Emit an event when a specific piece of state changes in vuex ...
Inside a component I want to watch for changes to the authed state and send an AJAX call to the server. It needs...
Read more >Integrating Server Sent Events with Vuex | Vue.js Developers
Updating your front-end with Server Sent Events (henceforth 'SSE') has never been easier, simpler and cleaner. Updating your application state in the ...
Read more >Actions | Vuex
Action handlers receive a context object which exposes the same set of methods/properties on the store instance, so you can call context. ...
Read more >A Guide to Vue $emit - How to Emit Custom Events in Vue
When we emit an event, we invoke a method with one or more arguments: ... Then, using the v-on or @ directive, a...
Read more >When to use vuex store vs events? : r/vuejs - Reddit
If a simple pass downward and event bubble upward will work, then stick with that. If multiple components all share the same data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just a quick comment, I think this should be added to the docs, I couldn’t really find it quickly while a lot of people need this.
A little bit more investigation and this works well for me: