No rows returned if no page views/ad requests?

23 views
Skip to first unread message

Raúl Mellado

unread,
May 26, 2012, 10:35:03 AM5/26/12
to adsen...@googlegroups.com
   Hi all,

   I am querying the Adsense Management API for a report in earnings similar to the one in the google-api-php-client example
 (metric: 'PAGE_VIEWS', 'AD_REQUESTS','CLICKS', 'AD_REQUESTS_CTR', 'COST_PER_CLICK', 'EARNINGS', 
  dimension: 'DATE')

, but adding a filter by a specific AD_UNIT_CODE. So, for those days in which, I guess, Page Views and/or Ad Requests are 0, I am not getting the row from the API for that specific day, thus leaving a gap in my report, like:

2012-01-01 xxx
2012-01-02 xxx
2012-01-04 xxx

   which seems to make the report a bit more confusing. Is this the expected behaviour? If so, is there a way to get all the rows, even if they show a 0 in all columns?

   Thanks for your help!

Sérgio Gomes

unread,
May 28, 2012, 10:09:26 AM5/28/12
to adsen...@googlegroups.com
Hi Raúl,

This is indeed the expected behaviour; if there is no data for a given date, no row will be shown for it. This applies to all dimensions, not just dates and time periods, so for example if you choose PRODUCT_NAME as a dimension, you won't get back any rows for AdSense products which aren't being used.

I'm afraid there's no way of changing this behaviour; you'll need to fill in the gaps with zeroes yourself, which in your case should be a matter of iterating through a calendar of your desired time range.

Cheers,
Sérgio

---
Sérgio Gomes
Developer Relations

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


---

Raúl Mellado

unread,
May 29, 2012, 12:48:14 PM5/29/12
to adsen...@googlegroups.com
   Thanks Sérgio, now it's all clear!
Reply all
Reply to author
Forward
0 new messages