Reputation: 4619
I am currently trying to use the Adsense Management API to get earnings reports for today, yesterday, last 7 days, last 30 days, this month, last month and all time. I was able to get all reports but the All Time earnings report.
How should I go about extracting the total/lifetime/alltime earnings report when I do not know the starting date of the particular adsense account?
Upvotes: 0
Views: 948
Reputation: 7474
following answer of @philip-belgrave-herbert
{
"error": {
"errors": [
{
"domain": "global",
"reason": "partialReportData",
"message": "Data were not available for part of the requested date range. First date with a complete dataset: 2013-03-09"
}
],
"code": 400,
"message": "Data were not available for part of the requested date range. First date with a complete dataset: 2013-03-09"
}
}
so for the followig request string
startDate=2013-03-098&endDate=today
&dimension=COUNTRY_CODE
&dimension=COUNTRY_NAME
&dimension=AD_UNIT_SIZE_NAME
&metric=CLICKS
&metric=COST_PER_CLICK
&sort=COST_PER_CLICK
&useTimezoneReporting=true
&fields=rows,headers
First date with a complete dataset: 2013-03-09
by use of try / catch errors we could adjust our date :)
Upvotes: 0
Reputation: 4619
At the time of posting there was no simple way of knowing when a users adsense account was created, so I decided to use the date adsense was created which is June 18, 2003.
So when you want to get the All Time report using the Adsense Management API use:
start date: "2003-06-18"
end date: "today"
Upvotes: 0