Analytics
2.5K members online now
2.5K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

Custom dimension filters with OR not returning anything in Core Reporting API

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I posted this question on SO but didn't get any solid leads so far.

 

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.

 

I also found that using ga:dimension1 with other dimensions as part of OR or AND filters also results in 0 data returned, though usingga:dimension2 with other dimensions as part of OR or AND filters does return results.

 

I'm not sure why using a ga:dimension1 filter by itself would return data, but using that same expression as part of an OR filter would return nothing.

1 Expert replyverified_user

Re: Custom dimension filters with OR not returning anything in Core Reporting API

Top Contributor
# 2
Top Contributor
Hi Matthew,

could it be that the scope of the dimensions is such (different) that it does not allow for the query to return a value?

Kind regards,
Zorin
Web analyst @ escapestudio.net