Return number of all visits over all time


(rlesterphx) #1

I have a page that displays links to other pages that are tracked with Piwik. Everything is hooked up and working.

Next to each link I want to have the total number of views, from all time, displayed (via PHP).

What type of query URL should I use? I have something like this right now:
index.php?module=API&method=VisitsSummary.getVisits&idSite=x&period=year&date=last30&format=PHP&prettyDisplay=true&token_auth=x

Which returns an array like this:
a:11:{i:2000;d:0;i:2001;d:0;i:2002;d:0;i:2003;d:0;i:2004;d:0;i:2005;d:0;i:2006;d
:0;i:2007;d:0;i:2008;d:0;i:2009;d:0;i:2010;d:1499;}

I could add each years’ value together to get the total number, but isn’t there an easier way to do this?

Thanks.


#2

Same for me… how i can obtain total visits? :confused:


(Matthieu Aubry) #3

You can use period=range&date=2008-01-01,today for example


#4

Oh thanks, this works fine (but only in API, not in widget) :slight_smile:
I’ve starting today with stats, then i can use: period=range&date=2011-11-11,today (special date) :wink:

Just another info: how i can try to manual increment with old value from my old stats server (phpstats)?
Maybe i can edit a value in db and insert old parameters (just to maintain a full counter)? :slight_smile: