Si vous cherchez mon site professionnel, merci de cliquer ici.
An alternative to google analytic : piwik
If you are a webmaster, the traffic analysis must be one of the most important tasks for you, just after the development itself. You certainly know google analytic, but nowadays, there is also an interesting alternative ( meaning : not totally outdated comparatively to analytic).
Why using an alternative?
That’s the very first question. Google products have an outstanding quality which suffers no comparison, and even those who don’t like Google have to recognize it. Google search, Greader, Gmail, Google analytic : all of those products stand always far beyond their competitors.
The major problem comes from data storage. Are you ok to let a third party business group stores the whole statistic datas about your websites? If the answer is “no”, then Piwik is for you.
Piwik features

Piwik isn’t the strict equivalent of analytic, which has what seems to be an attribute of google products : “to always be beyond”. But it sticks quite close, and it’s the product that gave me the most significant satisfaction in the analytic alternatives, for now.
Features of Piwik include :
- An extremely complete set of statistics data.
- A modular ajax interface, widget based and customizable with drag’n'drop.
- A plugin system, to extend the base functionalities.
You’ll get a better idea of it when looking at the demonstration page.
Installation
The install process is quite straightforward :
- Download Piwik and unzip it.
- Upload its files on your server, where you want it to be accessible.
- Go to that location with your browser and follow the indication to complete the installation.
You’ll have to create a database as well, follow the usual steps for your host provider.
Once the installation is completed, you just have to use the interface to add websites, and add in it the javascript code provided.
Now, let’s see something a bit spicier.
Tip: have our own visits ignored
For your statistics to be the most relevant, you probably didn’t want to have you own visits logged, especially in massive development times. This can be done with some slight changes in the javascript code to be inserted in your page.
What I suggest is to create an arbitrary cookie and to let the Piwik javascript code test if it is there or not.
This is a typical snap of code that Piwik ask to insert :
<!-- Piwik -->
<a href="http://piwik.org" title="Web statistics" onclick="window.open(this.href);return(false);">
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://example.com/" : "http://example.com/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
<!--
piwik_action_name = '';
piwik_idsite = 3;
piwik_url = pkBaseURL + "piwik.php";
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
//-->
</script><object>
<noscript><p>Web statistics <img
src="http://example.com/piwik.php" style="border:0"
alt="piwik"/></p>
</noscript></object></a>
<!-- /Piwik -->
Change this code so it looks like this : (beware, the code is unique for each website, if you just copy/paste the underneath code, you will query example.com, asking to one up the stats of the website with id of 1
) :
<!-- Piwik -->
<a href="http://piwik.org" title="Web statistics" onclick="window.open(this.href);return(false);">
<script type="text/javascript">
match = /piwik_webmaster=(\d+)/.exec( document.cookie ) ;
piwik_webmaster = ( match != undefined && match[1] == “1″ ) ;
if ( ! piwik_webmaster )
{
var pkBaseURL = ((”https:” == document.location.protocol) ? “https://example.com/” : “http://example.com/”);
document.write(unescape(”%3Cscript src=’” + pkBaseURL + “piwik.js’ type=’text/javascript’%3E%3C/script%3E”));
}
</script>
<script type=”text/javascript”>
<!–
if ( ! piwik_webmaster )
{
piwik_action_name = ”;
piwik_idsite = 3;
piwik_url = pkBaseURL + “piwik.php”;
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
}
//–>
</script><object>
<noscript><p>Web statistics <img
src=”http://example.com/piwik.php” style=”border:0″
alt=”piwik”/></p>
</noscript></object></a>
<!– /Piwik –>
Now, Piwik won’t be called anymore if visitor has a cookie named piwik_webmaster with the value 1. You just have to set such a cookie with the webdev toolbar or the firecookie plugin for firebug.
But if you’re a developer using several browsers to look at your websites, it can be annoying to set some cookies for each one. A workaround can be to load such a page, after having uploaded it to the root of your domain as, for example, no-piwik.html :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <script type="text/javascript"> function setCookie( name, value, expires, path, domain, secure ) { var now = new Date(); now.setTime( now.getTime() ); if ( expires ) expires = expires * 1000 * 60 * 60 * 24; var expires_date = new Date( now.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } setCookie( 'piwik_webmaster', '1', 365, '/', document.domain, false ) ; </script> <p>done</p> </body></html>
You now just have to load this page in each of your browsers, the cookie will expire one year later.





Comments
hey thanks for commenting on my blog, every little bit helps. take care.
Just happened upon your site today. Very interesting, I learned some interesting things. Vance
Write a Comment