Reputation: 14048
I'm trying to get daily visits from my instance of piwik for every day in the week.
Currently this query is returning the sum of all my visits for the entire week. Is there any way to separate this out into days?
http://piwikexample.com/?module=API&method=VisitsSummary.getVisits&idSite=1&period=range&date=2011-08-18,2011-08-25&format=json&token_auth=#########
Upvotes: 2
Views: 2669
Reputation: 2383
I had to use the old-fashioned trial-and-error approach.
period
set right:&period=day&date=last10
&period=day&date=previous10
&period=day&date=2011-08-18,2011-08-25
Just make sure you use period=day
instead of period=range
and you'll be good to go. See this note from the API:
Note: if you set 'period=range' to request data for a custom date range, the API will return the sum of data for the specified date range.
Reference: Reporting API (date) section
Upvotes: 1
Reputation: 14048
Actually figured it out. What I was missing is:
lastX for the last X periods including today (eg &date=last10&period=day would return an entry for each of the last 10 days including today). This is relative to the website timezone.
From http://piwik.org/docs/analytics-api/reference/#API
Upvotes: 7