Reputation: 11
I have created a single page app using vue.js. I need to track my logged in users in google analytics. I can do this by sending a User-ID variable back to google analytics. I have done this before by simply setting the variable and sending it back to google analytics.
This time I am using Vue.js and for my analytics and I am using a very nice plug in MatteoGabriele/vue-analytics.
My problem is I don't know how or where to set my User-ID variable in my code.
Upvotes: 1
Views: 1313
Reputation: 11
Have been trying to figure out the same question, and from closed issues 79, and 178, this looks like the suggested method.
this.$ga.set('userId', 123456)
Upvotes: 1
Reputation: 305
You need to install vue-analytics first,
run npm install vue-analytics
then, in your app.js or main.js import vueAnalytics
import VueAnalytics from 'vue-analytics';
and then,
Vue.use(VueAnalytics, {
id: 'UA-xxxxxxxxx-x', router
});
Remember to replace the 'UA-xxxxxxxxx-x' with your Tracking ID.
for better understanding use the vue-analytics documentation
Upvotes: 0