jork
jork

Reputation: 13

Google Analytics GA4 Content Group

I have ga4 google analytics on my website running and the realtime reporting is great

I will like to have a new report using "content group" for grouping website pages (+3000) in 20 or 30 basic topics

I tried to follow https://support.google.com/analytics/answer/11523339?hl=en and added

gtag('set', 'content_group', 'ZZZ'); 

in my GA4 script after

gtag('config', 'G-nnnnn' );  

with ZZZ changing according on each webpage. ZZZ can took around 30 different values

48 hs later, although not seen any error in chrome console, if I go to google analytics -> "Pages and screens: Page title and screen class" report and filter the 1st column by "content group" I only get a blank line and not the ZZZ values

what I'm missing ? thanks

Upvotes: 1

Views: 1085

Answers (1)

Will
Will

Reputation: 491

The documentation is just wrong for GA4. You cannot use set to set content_group with GA4 like you can with UA. Rather, content_group must be set with the config call, like this:

gtag('config', 'G-nnnnn', {'content_group': 'ZZZ'});

or alternatively, with individual events:

gtag('event', 'event_name', {
    'content_group': 'ZZZ',
    // other event data
});

The latter can also be used in combination with the former to override the page-wide content group for a single event.

Additionally unlike UA where you could set multiple content groups with content_group1, content_group2, ..., etc. GA4 only supports the one content group.

Upvotes: 5

Related Questions