user3814785
user3814785

Reputation: 23

Custom Dimension is being set but cannot query via API

I can easily set custom dimensions in Google Analytics as

ga('set', 'dimension2', '100');

The data can be seen in Analytics also. But I cannot use filter by the custom dimension while querying via Google Analytics API like

'filters'=>'ga:dimension2==100'

The error says :

"message":"Unknown dimension(s): ga:dimension2\nFor details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets."}],"code":400,"message":"Unknown dimension(s): ga:dimension2\nFor details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets."}}

Please help me to query analytics with filter by custom dimension.

Upvotes: 0

Views: 666

Answers (1)

kirstilynn
kirstilynn

Reputation: 13

Custom Dimensions are defined at the web property level, is it possible you are querying that filter on a view that does not belong under the web property you defined the dimension under?

You can also double check that you are using the correct dimension id with the Management API.

https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customDimensions/list

Upvotes: 1

Related Questions