Learn business growth with Google Analytics 4 Forums Google Analytics 4 Discrepancies in Google Analytics 4 UI and Google Data API Analytics

  • Discrepancies in Google Analytics 4 UI and Google Data API Analytics

    Posted by Eli on 30 July 2022 at 8:31 pm

    Hey there, I’m using the GA4 customer list and the google API analytics for GA4 to grab my daily traffic metrics for reports.

    I’ve been keeping an eye on things day-to-day and there’s something a bit fishy going on. The metrics I’m getting from the GA UI web and the google API are quite different.

    At first I thought I’ve messed up something in my pipeline or am doing something wrong. But even when I tried THE SAME REQUEST as per runReport from the official google guide using the property id and 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"
     ]
    }
    

    I’m still getting the same results!

    What I’ve noticed was that the “PagePathPlusQueryString”, “pagePath” and “pageTitle” dimensions in the API RunReportRequest are giving me higher and incorrect values. If I remove these dimensions, everything lines up perfectly between the GA API and Google Analytics Web UI.

    I’ve searched high and low, but I haven’t found any limitations or guidelines that say these dimensions need to be included in a request. So, I’m stumped as to why this is happening and why I’m getting the wrong values.

    I could really use some help figuring this out. Any ideas?

    Dylan replied 10 months, 4 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Harry

    Member
    3 September 2022 at 11:06 am

    Interesting observation! If you add up the totals yourself using a Google sheet, you’ll notice a discrepancy between your calculations and the grand total provided by the user interface of Google Analytics. From the looks of it, there seems to be a bug causing this difference in total values. Have a look at this screenshot for a clear view of the issue.

  • Dylan

    Member
    21 June 2023 at 3:56 pm

    It sounds like the Google Analytics API and the web interface aren’t aligning perfectly for certain dimensions. This could happen due to several reasons like data sampling, timing issues, different interpretation of metrics or filters etc. I’d recommend thoroughly checking all these possible factors. If the issue persists, you might have to directly reach out to Google’s support for more insights.

Log in to reply.