Total counter

I just wonder, Piwik is huge, and can do tons of stuff, but how come it is not possible to just show a normal counter, like VisitsSummary.get (idSite, period, date), but instaed of (period, date) then just a VisitsSummary.get (idSite, all) function?

Thanx for any reply.

You mean something like:


<?php
define('PIWIK_INCLUDE_PATH', '..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";

Piwik_FrontController::getInstance()->init();

$token = 'anonymous';
$start = '2008-01-01'; // use the earliest date in your database
$today = date('Y-m-d');
$request = new Piwik_API_Request('
			method=VisitsSummary.get
			&idSite=1
			&date='.$start.'%2c'.$today.'
			&period=day
			&format=PHP
			&serialize=0
			&token_auth='.$token.'
');
$result = $request->process();

$total = 0;
foreach ($result as $index => $val) {
	@$total = $total + $val['nb_visits'];
}

echo "$total";

Exactly, youre the man, thanx very much.

[quote=vipsoft @ Apr 26 2009, 03:10 PM]You mean something like:


<?php
define('PIWIK_INCLUDE_PATH', '..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";

Piwik_FrontController::getInstance()->init();

$token = 'anonymous';
$start = '2008-01-01'; // use the earliest date in your database
$today = date('Y-m-d');
$request = new Piwik_API_Request('
			method=VisitsSummary.get
			&idSite=1
			&date='.$start.'%2c'.$today.'
			&period=day
			&format=PHP
			&serialize=0
			&token_auth='.$token.'
');
$result = $request->process();

$total = 0;
foreach ($result as $index => $val) {
	@$total = $total + $val['nb_visits'];
}

echo "$total";

[/quote]

How can i display VisitsSummary on the image?
Thanx for reply.

[quote=dohtor @ Jun 25 2009, 01:19 PM]How can i display VisitsSummary on the image?
Thanx for reply.[/quote]

just you installed VisitsSummary ?

Yes!!!
I think he just installed!!!

i get the error:

Fatal error: Call to undefined function spl_auto_register() in /var/www/virtual/kd10065.iw-h.de/fredyyswunschzettel.de/htdocs/piwik/core/Loader.php on line 107

is there a way to sum up to pages with one request? like siteid 4+5?

Hi, the code from post #2 does not work for me. I tried to integrate it into the footer.php of my WordPress installation but as soon as the line “$result = $request->process();” gets processed my browser shows the sites source code instead of the site itself. Any ideas?