• Minh

    Member
    8 May 2023 at 11:54 am

    Yeah, the doc is wrong when it comes to GA4. You can’t use ‘set’ to drop in ‘content_group’ with GA4 like you can with UA. Instead, ‘content_group’ needs to be set with ‘config’ call, like this:

    `
    gtag(‘config’, ‘G-nnnnn’, {‘content_group’: ‘ZZZ’});
    `

    Or you can do it with individual events:

    `
    gtag(‘event’, ‘event_name’, {
    ‘content_group’: ‘ZZZ’,
    // other event data
    });
    `

    Or even mix ‘n match to override the page-wide content group just for one event.

    Don’t forget that unlike UA where you could have ‘content_group1’, ‘content_group2’, …, etc. GA4 only lets you use one content group.