1
votes

I'm attempting to use the Google Analytics Core Reporting API to query for some filtered sessions data. Filter A returns results, filter B returns results, but applying filter A OR B returns no results. Am I missing something?

Filtering by one custom dimension with an exact match:

curl -X GET -H "Authorization: OAuth <redacted>"
     "https://www.googleapis.com/analytics/v2.4/data
        ?ids=ga:<redacted>
        &metrics=ga:sessions
        &start-date=2014-06-01
        &end-date=2016-05-25
        &filters=ga:dimension1==MyMatchString"

Returns

<dxp:aggregates>
  <dxp:metric name="ga:sessions" type="integer" value="12345"/>
</dxp:aggregates>

Filtering by another custom dimension with an exact match:

curl -X GET -H "Authorization: OAuth <redacted>" 
     "https://www.googleapis.com/analytics/v2.4/data
        ?ids=ga:<redacted>
        &metrics=ga:sessions
        &start-date=2014-06-01
        &end-date=2016-05-25
        &filters=ga:dimension2==MyMatchString"

Returns

<dxp:aggregates>
  <dxp:metric name="ga:sessions" type="integer" value="67890"/>
</dxp:aggregates>

But filtering with either custom dimension having an exact match

curl -X GET -H "Authorization: OAuth <redacted>" 
     "https://www.googleapis.com/analytics/v2.4/data
        ?ids=ga:<redacted>
        &metrics=ga:sessions
        &start-date=2014-06-01
        &end-date=2016-05-25
        &filters=ga:dimension1==MyMatchString,ga:dimension2==MyMatchString"

Returns no results:

<dxp:aggregates>
  <dxp:metric name="ga:sessions" type="integer" value="0"/>
</dxp:aggregates>

I also tried these same requests with v3 of the API but had the same result.

1
Are the results similar on web interface ? Also try setting samplingLevel : HIGHER_PRECISION .Manoj Purohit
@Kola Setting samplingLevel : HIGHER_PRECISION had no effect. By web interface do you mean ga-dev-tools.appspot.com/query-explorer ? I can't use that to test this because I don't own the Analytics account to authorize it--it's one of our client's and I only have the refresh_token.mbil

1 Answers

0
votes

Just a thought. Could it be that your that the custom dimension hit level are different and can never be true together for the metrics that you are looking up? https://support.google.com/analytics/answer/2709828?hl=en

What are the hit levels or details of each dimension in use?