Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show a Hit/Visits Counter on my page which uses Piwik for analytics

I want to show the Visits for the current day on a homepage. That page is tracked with Piwik.

How to use the API with PHP to get the (unique) visits and hits for today so that I can show them somewhere on the page

like image 900
kmindi Avatar asked Sep 24 '10 11:09

kmindi


1 Answers

$result = file_get_contents("http://mysite.com/piwik/?module=API&method=VisitsSummary.getUniqueVisitors&idSite=1&period=day&date=today&format=php");
echo unserialize($result);
like image 61
Mischa Avatar answered Sep 25 '22 10:09

Mischa