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.