Piwik Step By Step Installation Guide

This is the installation guide for Piwik v0.4.2. This guide is for beginners who would like to install Piwik on their site and this guide assumes that the user have some basic knowledge of Windows commands as well as some webhosting how-to. For those who worry, well, don’t worry. The steps detailed here will guide you through the process of installing the Piwik scipt in no time at all. For those who have no idea what Piwik does, it is an open source webstats script. Yes, it gives you (the webmaster) detailed information on the visitors to your website. This is extremely useful for webmasters planning to optimize their site and improve their visitors experience. I believe that a webstat script is one of the most important aspects when it comes to website planning. There are actually quite a number of webstat scripts available out there.But in my opinion, Piwik is one of the better ones.

In order to install Piwik, you will need a webhost which supports PHP and MySQL. Most webhost will be able to support these features. If yours don’t, then change to a better webhost. You should also get the userid and password (and the URL) to access your webhost admin console as you will need to create the database. Some webhost do not have an admin console, so you will have to ask your webhost to create a database and user for you.

Anyway, let’s begin the step by step guide.

First of all, you will need to go to www.piwik.org and download the latest version of Piwik. At time of writing, the latest version was 0.4.2. Just click on the red rectangle to download the file. It should come in a zip (archive) package.

Download it and save it somewhere you can remember.

I saved it on my desktop. Your next step would be to extract the files out. I use IZArc to extract the zip file. You can use any unzipping utility. The steps should be the same. Just remember where you have extracted your files to.

After double clicking on the zip file, you will be able to see what is inside the archive. As you can see above, there is a directory and a html file.  Click on extract to extract out the files.

Remember the location where you extract the files. You will need them later. Make sure you extract ALL the files out.

There, I have extracted the files out. The piwik folder contains all the necessary files to start your installation. This is the folder that has to be uploaded to your server.

Start your FTP (File Transfer Protocol) program. Here I am using Filezilla. I have been using this software for years and it is one very solid piece of coding. You can of course use other FTP programs to do your uploading. I believe the steps should be the same. Browse your FTP explorer to the folder which you have just extracted. In this example, I will be uploading the entire piwik folder to my server. If you are planning to place the piwik files in another directory, then you should create the directory on your server and then upload all the contents of the piwik folder into that directory. Make sure you upload ALL the files in the folder.

After a while, the files would have been uploaded. Just browse to check whether the files are complete. Compare them if necessary.

Now, let’s start your browser and surf to the piwik installation URL.  If you web address is http://www.something.com, you should browse to http://www.something.com/piwik/. Of course if you had uploaded the piwik files to another directory, then you should change the URL accordingly. So for example, if you had uploaded the files to “webstat” directory, browse to http://www.something.com/webstat/.

Anyway, you will be greeted with the above display. It is telling you that some of the file permissions are wrong and you need to do some changes to it. This requires your FTP program.

With your FTP program, you should browse to the tmp directory of your server (and not your local directory) and look for the tmp folder. Next you should right click and choose “File Attributes”. For some other FTP programs, it might be known as “File Permissions” or “CHMOD” or something like that. Refer to your FTP program’s documentation for more information.

Now you will have to enable all the read, write and execute permissions. Some FTP programs allow you to just key in the numeric value, which is “777″. Click on Okay when you are done. This is how you CHMOD something. Easy right?

Now you will have to create two subdirectories in the tmp directory. They are “cache” and “templates_c”. You will also need to CHMOD them the same way as you CHMOD the tmp directory. So enter into the tmp directory and right click to choose “create directory”.

Create the cache subdirectory. Do the same thing to create the “templates_c” subdirectory. And then you will have the CHMOD 777 these two subdirectories as well. Just follow what I have done with the tmp directory.

Now, let’s click on refresh the page and see whether everything is done correctly or not.

Looks like everything is done okay. Click on Next to continue.

Hmmmm……what? It seems that there is yet another directory with the wrong file permission. What do you need to do? Well, do the same thing as with the tmp directory. Using your FTP program, CHMOD 777 the “config” directory.

There, all done. Click on Next to carry on.

Now you will need to setup your MySQL database for Piwik. I have written two tutorials on how to create the MySQL databases.  One is for Cpanel while the other is for DirectAdmin. Once you have created the databases (or have asked your webhost to do it for you), you will have to key in the user (aka login), the password and the database name. As for the MySQL Server, it should commonly be “localhost”. Get this information from your webhost. Unless you are using the database for multiple scripts, you do not have to worry about the table prefix. Click on Go to continue.

Ahhh…success! The database table has been created. Hooooooray! Click on Next.

There

Now, you will have to create this super user. Please take note of the super user and password and keep them safe somewhere. Without these information, you will not be able to login to your Piwik admin console.

Just keep in a name for the website name and your website URL.

Okay, all it almost done! The next thing is to copy down this information. You will need to add these into your website files.

Congrats, your installation is complete. Have a beer! But before having that 6th can of beer, remember to CHMOD the config folder back to 755. Yes, using your FTP program, browse to the config directory and CHMOD 755. This is a security risk you should avoid.

In this example, I am using WordPress blog script and this is the footer file. In order to add the Piwik information to my WordPress, I opened up the footer file with my favourite text editor (PsPad Editor) and add them just above the </body> section. For other scripts, you will need to do the same thing. You can actually add them anywhere between the “body” tags. But I would recommend you to add them at the footer section. If you are using static html files, you will need to add this text in all your files. Err….good luck.

And so there you have it, everything is done. You can now start enjoying your webstat program in real time. Life is good.

This tutorial is written by someone. He is the owner of the Singapore Business Directory. The directory comes with a very comprehensive listing of Singapore Travel Agencies. If visit the directory if you are looking for a reliable travel agent or a ticketing agent.