-
Inconsistencies between Google Analytics 4 Data API and Web Interface Results
Hey, could use some help with a problem that’s been nagging me.
I’m currently using the GA4 data API to get daily sales data every day for our custom analytics dashboard. But I’ve noticed something weird – the data in our reports seem to differ from what we see in the GA4 interface (like the custom exploration reports) and the GA4 query explorer. Got me scratching my head, I tell ya.
Let me give you an example of a data request we typically use:
{ "dimensions": [ { "name": "date" }, { "name": "platformDeviceCategory" } ], "metrics": [ { "name": "addToCarts" } ], "dateRanges":[ { "startDate": "2daysAgo", "endDate": "yesterday" } ], "keepEmptyRows": true }
Now, when I check the GA4 interface or the GA4 query explorer, the “platform/device category” dimension comes back with all 3 values for a specific date. But the odd thing is, when using the GA4 data API, the same “platform/device category” dimension comes back with only 2 values for that date. It’s like the “web/tablet” row (the orange block) just up and vanished.
I’ve read the official guide on data sampling and pretty sure our data size is far from the sampling threshold, even with the date range being 2 days. The data should NOT be sampled in our case. I also discovered that removing the “platform/device category” dimension from the request body gives me matching results from the data API and the web interface. Doesn’t really make sense, does it?
I’m stumped. Any chance there’s a way to get the API response to look exactly like what I can see in the GA4 query explorer? And if there isn’t, I could really use some pointers as to why there’s a discrepancy – gotta convince the folks here that the data on our dashboard is trustworthy.
Any help you can offer would be much appreciated!
Log in to reply.