4.6K members online now
Understand information in your reports and troubleshoot reporting issues such as self-referrals, (not set) data, and inaccurate information
Guide Me

Number of Results in UI Don't Match GoogleAnalytics API

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have a site that gets a fair amount of search traffic.  For the month of May 2016 my site had 77,185 Landing Pages that received traffic from a Search Engine (according to the UI).  To generate this report within the GoogleAnalytics UI I ran the "Acquisition > Overview" report, clicked on the "Organic Search" dimension, then changed the Primary Dimension to "Landing Page".  I see the top 10 results but looking below the table I see 77,185 results.


This is too much for me to manually pull 5k rows at a time, so I hit the API using Python.  See the code below.  I fetched the results in increments of 10,000 but I only get 24,454 rows through the API.  This seems like a pretty big difference (77k vs. 24k).  The last row returned was a page that received 33 search referrals.  In the UI the last row received 1.  So, it's clear I'm not getting all Landing Pages from the UI.


Is there a reason I'm not getting all of the Landing Pages out of the UI?  Is my code setup correctly?


metrics = "ga:sessions"
dimensions = "ga:landingPagePath"
samplingLevel = "HIGHER_PRECISION"
filters = "ga:sourceMedium=@/ organic"
sort = "-ga:sessions"
maxResults = 10000

results = []
start_index = 1
looking = True

while looking == True:

    # Fetch data from API
    data =

    # Parse and save query results
    for row in data['rows']:
        results.append(["2016-05-01"] + row)

    # check for more results
    if len(data['rows']) < maxResults:
        looking = False
        start_index += maxResults
        print start_index



1 Expert replyverified_user

Re: Number of Results in UI Don't Match GoogleAnalytics API

Rising Star
# 2
Rising Star
Hi Michael,

Two questions: 1. Did you get any sampling in your API pull? (I'd be shocked if there was that much of a differnce due to sampling as it would be VERY unlikely)

2. Has your default Channel Grouping for Organic been changed to include other mediums / traffic?

You may want to look at Behavior>>SiteContent>> Landing Pages with an Organic segment applied to see what your row count is here. Or pull in a secondary dimension and do an advanced filter. You may also want to check in Google Sheets if you want a check against your code.

Bottomline: I would not expect to see such different results between the API and UI.

Hope that helps.


Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Number of Results in UI Don't Match GoogleAnalytics API

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Theo,

1. Yes, there is sampling in the API response.
2. I'm not sure. Is that something I can change myself? I've tried with the filter above, as well as `filters = "ga:channelGrouping==Organic Search"` and got the same result.

I can tell that the totals are the same, looking at `data['totalsForAllResults']`. The only issue I have is I can't access all of the rows, for some reason the API limits me to only 24k rows.