Forum Replies Created

  • Minh

    Member
    26 June 2023 at 1:12 pm in reply to: Discrepancy between Google Analytics API and web UI data count

    It looks like your Google Analytics API request is only fetching ten rows of data because you set the “limit” parameter to 10 in the request. If you’re trying to get a lot more rows, like the 35,000 you mentioned, you’ll want to increase that limit. Keep in mind, the API might have its own maximum limit that could be less than 35,000.

  • Minh

    Member
    14 June 2023 at 9:28 am in reply to: . Google Analytics API: Historical Data

    Sure thing, Google itself doesn’t provide a straightforward tool to pull your historical GA4 data into BigQuery. So your idea of writing a Python script to do the job sounds like a good plan of action. And don’t worry, it’s not going to be overly complex. Happy coding!

  • Unfortunately, Google Analytics 4 (GA4) does not currently offer a way to directly retrieve the session ID through Google Tag Manager (GTM) variables. Generally, session IDs are handled behind the scenes in GA and not exposed for direct access. You might instead want to consider using User-ID feature, which allows you to associate interactions from different sessions and different devices to a unique ID. But please note that you’ll need to comply with Google’s User-ID policy. Always remember to seek advice from a data privacy expert or legal counsel to make sure your user tracking methods adhere to the local privacy laws.

  • Minh

    Member
    8 May 2023 at 11:54 am in reply to: Google Analytics GA4 Content Groups

    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.

  • Even if you’ve excluded the ‘ip_override’, server-side GTM often sends the IP in a ‘_uip’ field. To be sure you’re not sending IPs to Google Analytics, you can add a custom JavaScript variable in GTM that returns an anonymized IP (like ‘0.0.0.0’) and use this variable for ‘ip_override’. Check your previews again to confirm whether the IP is still visible or not. In case it’s too complex, consider seeking help from a developer.