Re: Rails Client API Multiple Metric Issue

83 views
Skip to first unread message

Michael Ni

unread,
Nov 7, 2012, 11:09:00 PM11/7/12
to adsen...@googlegroups.com
bump

On Wednesday, September 26, 2012 1:43:09 PM UTC-7, David Fritz wrote:
I am using the rails client api, and having issues while requesting multiple metrics. If I pass one metric I get a report.
result = api_client.execute({
    :api_method => adsense.reports.generate,
     :parameters => {'startDate'=> @start_date, 'endDate' => @end_date, 'accountId' => @id, 
       'metric' =>['EARNINGS'],
       'dimension' => "MONTH"
          }
   })

However if I pass in multiple metrics, my report is empty. 

result = api_client.execute({
    :api_method => adsense.reports.generate,
     :parameters => {'startDate'=> @start_date, 'endDate' => @end_date, 'accountId' => @id, 
       'metric' =>['CLICKS','PAGE_VIEWS','PAGE_VIEWS_CTR','PAGE_VIEWS_RPM','EARNINGS'],
       'dimension' => "MONTH"
          }
   })

I read a similar bug in the PHP library which appears to be fixed now and was wondering if this is a bug, or I am doing something silly that is preventing me from getting a report.  Thanks! 

Jose Alcérreca (AdSense API Team)

unread,
Nov 13, 2012, 5:19:02 AM11/13/12
to adsen...@googlegroups.com
Hi there,

This problems looks like a bug in the Ruby client library and it has already been reported


Just for clarification: there are some metrics and dimensions that you can't mix. The quickest way to know if a combination makes sense is trying it with the APIs explorer. An error will trigger:
 - a 400 Bad Request response, or
 - a 200 OK response containing a warning field. 

If you use the APIs explorer to generate a report using the metrics and dimensions from David's post, the report is generated and there are no warnings nor errors. Combining dimensions "AD_UNIT_CODE" and "CUSTOM_CHANNEL_CODE" will return a "400 Bad Request" response.

Cheers!
Jose

---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers.google.com/adsense

Follow us on our Google Ads Developer page on Google+ and our Google Ads Developer Blog to learn more about the different Ads APIs at Google.


Jose Alcérreca (AdSense API Team)

unread,
Nov 29, 2012, 10:28:12 AM11/29/12
to adsen...@googlegroups.com
It really would, thanks for the suggestion.

Cheers,
Jose
---
Jose Alcérreca
Developer Relations

Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


Google Inc.| Developer Relations | AdSense API Team | developers.google.com/adsense


On Thursday, 29 November 2012 03:23:53 UTC, Group Participant wrote:
A list of valid and/or invalid combinations would be a good addition to the documentation.

2012年11月13日火曜日 19時19分03秒 UTC+9 Jose Alcérreca (AdSense API Team):
Reply all
Reply to author
Forward
0 new messages