1

I'm trying to solve this issue for the last 2 days.
When I'm using Google Analytics API V4 I get fewer results than I'm using the API V3. I'm using the exact same parameters in both versions.

API v4 implementation
Uri: https://analyticsreporting.googleapis.com/v4/reports:batchGet?access_token=_ACCESS_TOKEN_
Method: POST
Body:

{
  reportRequests: {
    viewId: "3829366",
    dateRanges: {
      startDate: "2017-05-19",
      endDate: "2017-05-19"
    },
    dimensions: [
      {
        name: "ga:dimension1"
      },
      {
        name: "ga:source"
      },
      {
        name: "ga:medium"
      },
      {
        name: "ga:campaign"
      },
      {
        name: "ga:channelGrouping"
      },
      {
        name: "ga:fullReferrer"
      },
      {
        name: "ga:adMatchedQuery"
      },
      {
        name: "ga:country"
      },
      {
        name: "ga:city"
      }
    ],
    metrics: [
      {
        expression: "ga:sessions"
      }
    ],
    filtersExpression: "ga:dimension1=~(598a56704f19aa39c5)|(674456acd5f2a5f1c2)|(9545632042f1223ced)|(24a1e3c96ba81890dc)|(7dd83f2d0321aae0d6)|(a68f93efad7d7574c8)",
    samplingLevel: "LARGE"
  }
}

From this call I get only 1 result.

API v3 implementation
Uri: https://www.googleapis.com/analytics/v3/data/ga
Method: GET
Query Parameters:

?ids=ga:3829366
&start-date=2017-05-19
&end-date=2017-05-19
&metrics=ga:sessions
&dimensions=ga:dimension1,ga:source,ga:medium,ga:campaign,ga:channelGrouping,ga:fullReferrer,ga:adMatchedQuery
&filters=ga:dimension1=~(598a56704f19aa39c5)|(674456acd5f2a5f1c2)|(9545632042f1223ced)|(24a1e3c96ba81890dc)|(7dd83f2d0321aae0d6)|(a68f93efad7d7574c8)
&samplingLevel=higher_precision
&access_token=_ACCESS_TOKEN_

From this call I get 6 results, the right results.

I would be very grateful for any help!
Thanks!

Chen Alon
  • 242
  • 2
  • 5
  • 13

1 Answers1

0

Have you tried both queries in the GA API explorer? The only thing I could think of is some sampling issues.

turtlepower
  • 708
  • 1
  • 7
  • 18
  • Hi, thanks for your answer! I tried this in the Query Explorer, https://ga-dev-tools.appspot.com/query-explorer/, the results there are from the API v3 (https://monosnap.com/file/kX9TVzLPGe9kNIr1dqgRSiCK8CIYPc). So far, there were no sampling on the data (This is from the Query Explorer - http://take.ms/xVJgg). – Chen Alon May 28 '17 at 07:25