Error while retrieving adsense earnings for today

58 views
Skip to first unread message

Nicolas Daudin

unread,
Jan 21, 2015, 2:14:32 PM1/21/15
to adsen...@googlegroups.com
Hi

When I try to retrieve earnings of adsense very early in the morning from a cron on a server based in France, I get an error.
If today for example is the 21st of January, when I send the date to Adsense API I request earnings from 21st to 21st.

Is this because the Adsense API works on Pacific timezone?

If that's the case, how can I work around this? Should I get earnings from "yesterday"? Should I check earnings only after a certain time (9am in france...)

Regards,
Nicolas.

Dean Lukies (Adsense API Team)

unread,
Jan 21, 2015, 2:30:32 PM1/21/15
to adsen...@googlegroups.com
Hi Nicolas,

are you specifying a date or using the keyword 'today' - use the keyword and it should work, let me know if not?

also, please remember that the earnings will be an estimate and are subject to change.

thanks,
Dean

Nicolas Daudin

unread,
Jan 22, 2015, 5:50:05 PM1/22/15
to adsen...@googlegroups.com
Hi Dean

Thanks for your quick answer.

No, I'm specifying the date directly, like this (node.js code)

var reportParams = {
                accountId : accountId,
                auth : oauth2Client,
                startDate: day,
                endDate: day,
                dimension:'DATE',
                metric:'EARNINGS'
            }

day being of format YYYY-MM-DD

I didn't know that there was a keyword 'today' available. Should I put like this in parameter 'startDate'?

Regards,
Nicolas.

Dean Lukies (Adsense API Team)

unread,
Jan 23, 2015, 9:39:00 AM1/23/15
to adsen...@googlegroups.com
Hi Nicolas,

take a look at this Relative Dates
you should be able to use 'today' in place of your day variable

If you find it faster, you can work out your parameters on the developers site https://developers.google.com/adsense/management/v1.4/reference/accounts/reports/generate#try-it

thanks,
Dean

PS: I wanted to remind people about stackoverflow.com and the adsense-api tag !
Reply all
Reply to author
Forward
0 new messages