Very simple counter display on html website


#1

Hello, I just started using this and after searching don’t see a clear answer for this.

I would like to place a visitor count (numbers only) on a static html website to show how many visitors or visits. I found some documention on how to display a lot of stuff but not a simple thing like this.

Thanks


#2

you can make it whit php and the api from your piwik.

my code
–> change
Sign in - Piwik == your piwik addres
".$site[‘idsite’]." == id of your site
token == token from a account on piwik


<?php
    $data = json_decode(file_get_contents("http://mych-studio.com/admin/piwik/index.php?module=API&method=VisitsSummary.get&idSite=".$site['idsite']."&period=range&date=2000-01-01,today&format=json&token_auth=token"  , FILE_USE_INCLUDE_PATH), true);
    
 echo 'this site have'.$data['nb_actions'].' vieuws,<br/>From '.$data['nb_visits'].' visiters.';
?>


#3

Hi and thanks for your reply. I don’t quite understand this. Can the php be used on a normal html site?

Do you have this as an example anywhere.

Thanks


#4

http://www.oldtimerbeurs-hoogstraten.be/

see the right side whit the title "Statestieken"
you can load the code whit jquery into a html page (i do it so the paga load faster els it must wait for piwik)


(yamyam) #5

Hello christophe195!

Thanks for your work and help, but could you also take a look at this thread:
http://forum.piwik.org/read.php?2,110695

It is regarding the same subject, but more detailed and with piwik 2.x

I would appreciate your help!
Thanks!