Different report results between Google Analytics 4 UI and Google Data API data
Question:
I have a list of customers set in GA4 and I am using the google API analytics for GA4 to retrieve daily the traffic metrics for reporting purposes.
Checking the metrics day by day, I noticed a lot of differences in the metrics between the GA UI web and the answer given by google API.
I thought that there was an error in the logic of my pipeline but I obtained the SAME VALUES, testing THE SAME REQUEST by runReport from the official google guide
using:
- property id
- JSON request body:
{
"dimensions": [
{
"name": "date"
},
{
"name": "deviceCategory"
},
{
"name": "hostName"
},
{
"name": "pagePathPlusQueryString"
},
{
"name": "pageTitle"
},
{
"name": "sessionDefaultChannelGrouping"
}
],
"metrics": [
{
"name": "engagedSessions"
},
{
"name": "newUsers"
},
{
"name": "screenPageViews"
},
{
"name": "sessions"
},
{
"name": "userEngagementDuration"
}
],
"dateRanges": [
{
"startDate": "yesterday",
"endDate": "yesterday"
}
],
"metricAggregations": [
"TOTAL"
]
}
After some tests, I realized that I retrieve higher and wrong values ONLY when I use in the API RunReportRequest the dimensions "PagePathPlusQueryString" and/or "pagePath" and/or "pageTitle".
The only way that allows me to obtain the perfect match between GA API and Google Analytics Web UI is by removing these values.
I didn’t see any limitations or best practices about the dimensions above need to be included in a request, so I don’t understand where the error is and why I get the wrong values.
Please, can you help me?
Answers:
I have a list of customers set in GA4 and I am using the google API analytics for GA4 to retrieve daily the traffic metrics for reporting purposes.
Checking the metrics day by day, I noticed a lot of differences in the metrics between the GA UI web and the answer given by google API.
I thought that there was an error in the logic of my pipeline but I obtained the SAME VALUES, testing THE SAME REQUEST by runReport from the official google guide
using:
- property id
- JSON request body:
{
"dimensions": [
{
"name": "date"
},
{
"name": "deviceCategory"
},
{
"name": "hostName"
},
{
"name": "pagePathPlusQueryString"
},
{
"name": "pageTitle"
},
{
"name": "sessionDefaultChannelGrouping"
}
],
"metrics": [
{
"name": "engagedSessions"
},
{
"name": "newUsers"
},
{
"name": "screenPageViews"
},
{
"name": "sessions"
},
{
"name": "userEngagementDuration"
}
],
"dateRanges": [
{
"startDate": "yesterday",
"endDate": "yesterday"
}
],
"metricAggregations": [
"TOTAL"
]
}
After some tests, I realized that I retrieve higher and wrong values ONLY when I use in the API RunReportRequest the dimensions "PagePathPlusQueryString" and/or "pagePath" and/or "pageTitle".
The only way that allows me to obtain the perfect match between GA API and Google Analytics Web UI is by removing these values.
I didn’t see any limitations or best practices about the dimensions above need to be included in a request, so I don’t understand where the error is and why I get the wrong values.
Please, can you help me?