google-analytics-apigoogle-analytics-4

Google GA4 API - Including "totalUsers" metric changes number of rows returned


I'm trying to get some data from Google Analytics GA4 API and I noticed that when I include or exclude the "totalUsers" metric, it changes the number of rows returned by a huge amount. I was wondering if anyone has encountered this or might have an idea why this is happening.

This is what my call looks like without "totalUsers" metric and I get 126 rows of data.

{"dimensions":[{"name":"date"},{"name":"sessionCampaignName"},{"name":"sessionDefaultChannelGroup"}],"metrics":[{"name":"conversions"},{"name":"sessions"}],"dateRanges":[{"startDate":"2023-11-01","endDate":"today"}],"limit":"1000","keepEmptyRows":true}

This is my call when I add in the "totalUsers" metric and I only get 17 rows of data.

{"dimensions":[{"name":"date"},{"name":"sessionCampaignName"},{"name":"sessionDefaultChannelGroup"}],"metrics":[{"name":"conversions"},{"name":"sessions"},{"name":"totalUsers"}],"dateRanges":[{"startDate":"2023-11-01","endDate":"today"}],"limit":"1000","keepEmptyRows":true}

The calls are the same other than the "totalUsers" metric. Thanks!


Solution

  • If your data has a low "totalUsers" count, and "Google Signals" is enabled, GA4 will hide the data using Data thresholds.

    Data thresholds are applied to prevent anyone viewing a report or exploration from inferring the identity or sensitive information of individual users based on demographics, interests, or other signals present in the data.

    To remove Data threshold, you can disable "Google Signals" or change Reporting Identity to "Device-based", check the article from Analytics Mania for detailed explanation.