skini82
skini82

Reputation: 436

Google analytics not recording content_group

I had the current code in my WebSite, and it was working until a week ago:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-142497713-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-XXXXXXX-1');
  gtag('set', {'content_group1': 'Guests'}); 
</script>

When my User log into my site the 'content_group1' becames 'My_User_type'.

I used to have charts filtered by content_group1 to see the typology of my users and how much they use my website.

Now it's not saving data of content_group1 and i cannot understand why. (I didn't change the footer of my page!)

Anyone have the same issue? Thanks. Dario.

Upvotes: 0

Views: 91

Answers (1)

XTOTHEL
XTOTHEL

Reputation: 5208

You need to call the "set" before the "config". Also using content groups like this is messy, the intent for this dimension is to group the content (ie, support, product), not for what the user type is. You should look into setting a custom dimension OR use the userid feature for your use case.

  gtag('set', {'content_group1': 'Guests'}); 
  gtag('config', 'UA-XXXXXXX-1');

Upvotes: 1

Related Questions