question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

user_properties in gtag

See original GitHub issue

Thanks so much Matteo! gtag is amazing, but I’m being blocked by a big thing:

How do I set user properties for a user, like the identify call in Segment, or https://developers.google.com/analytics/devguides/collection/app-web/user-properties for gtag?

In gtag, I can dynamically set user properties as follows:

gtag('set', 'user_properties', {
  favorite_composer: 'Mahler',
  favorite_instrument: 'double bass',
  season_ticketholder: 'true'
});

How would I do this with vue-gtag? I’ve already looked into this.$gtag.set but it doesn’t seem to apply.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MatteoGabrielecommented, Mar 4, 2020

I copy-pasted your call and it works for me tbh.

if did this

this.$gtag.set("user_properties", {
  favorite_composer: "Mahler",
  favorite_instrument: "double bass",
  season_ticketholder: "true"
});

and the event has being captured

Screenshot 2020-03-04 at 11 32 44

if you can make a small reproduction of this bug and give me the link I would have a look.

0reactions
zsigulicommented, Mar 8, 2022

This worked for me with vue3 and vue-gtag

import { set as GASet } from 'vue-gtag';
interface LoggedUserProperties {
  something: string;
}

....
function startLogging() {
  const userProperties: LoggedUserProperties = {
      something: 'thing',
    };
    GASet({ user_properties: userProperties });
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[GA4] User properties - Analytics Help - Google Support
User properties are attributes that describe groups of your user base, such as their language preferences or geographic locations.
Read more >
User properties | Measurement Protocol for Google Analytics 4
User properties describe segments of your user base, such as language preference or geographic location. Analytics automatically logs some ...
Read more >
GA4 User Properties (User Scoped Custom Dimensions)
User properties can be set either by calling the gtag('set') command in your website if you are using the global site tag (gtag.js)...
Read more >
Understanding User Properties In Google Analytics 4
It is up to you what user properties are useful to you, but some examples would be profession, height, high-value customer, nationality, etc....
Read more >
User-scoped Custom Dimensions in Google Analytics 4 (User ...
Documentation: user properties in GA4 ... Google Tag Manager vs GTAG https://www.youtube.com/watch?v=RxcfK.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found