How to use multiple dimension and metric values in google adsense version api 1.4 -
when generating reports google adsense management api v 1.4 can how listed here : https://developers.google.com/adsense/management/v1.4/reference/accounts/reports/generate
i checked out metrics , dimension given here : https://developers.google.com/adsense/management/metrics-dimensions
i tried pass these values in request , working fine me :
startdate=2015-07-07& enddate=2015-07-12& dimension=ad_unit_name& metric=ad_requests_ctr but how should pass multiple metric values ? example if want metric values :
ad_requests_rpm , ad_requests_rpm , clicks , earnings etc i tried separate them normal , url-encoded values of
":" "," " " (space) but nothing works me , getting error :
{ "error": { "errors": [ { "domain": "global", "reason": "invalidparameter", "message": "invalid value 'ad_requests_ctr:ad_requests_rpm'. values must match following regular expression: '[a-za-z_]+'", "locationtype": "parameter", "location": "metric[0]" } ], "code": 400, "message": "invalid value 'ad_requests_ctr:ad_requests_rpm'. values must match following regular expression: '[a-za-z_]+'" } }
so found solution pass multiple metric , dimension value , think poor api design google adsense team .
this how works :
get https://www.googleapis.com/adsense/v1.4/accounts/pub-423423423432/reports?alt=json& startdate=2015-07-07& enddate=2015-07-12& dimension=ad_unit_name& metric=ad_requests_rpm& metric=ad_requests_rpm& metric=clicks& metric=earnings
Comments
Post a Comment