I have a VueJS SPA in which I have user specific information which I want to send in GA once user logged-in as a custom dimension for each and every hit.
I have used VueGtag plugin to integrate GA 4 with my SPA.
Vue.use(VueGtag, {
config: {
id: "G-XXXXXXXXXX" // Data stream measurement ID
},
}, router);
User scoped custom dimension setup:
vue-gtag
plugin provides a way to send custom dimensions via customMap like below :
this.$gtag.customMap({ 'dimension2': 'age' })
this.$gtag.event('age_dimension', { age: 35 })
Also tried as per the gtag documentaion for GA4:
this.$gtag.query('set', { dimension2: 'age' })
this.$gtag.event('age_dimension', { age: 35 })
With above mentioned approaches. I can see the event data in Realtime but it is showing (not set) if looking in Engagement
tab along with some other class. For Ex: Pages and Screens
.
this.$gtag.query('set', 'user_properties', { age_dimension: '35' })
. You have this tagging example:this.$gtag.event('age_dimension', { age: 35 })
. This tagging specifies the event name isage_dimension
, the event parameter isage
, and the event parameterage
's value is 35. – UndulantArgument of type "set" is not assignable to parameter of type "event"
on usingthis.$gtag.query('set', 'user_properties', { age_dimension: '35' })
– Oreilly