====== Piwik on Simple Hosting ====== "Piwik is an open analytics platform currently used by individuals, companies and governments all over the world. With Piwik, your data will always be yours." - [[http://piwik.org/what-is-piwik/ | Source]] ===== Requirements ===== * PHP - MySQL Simple Hosting instance * [[http://cli.gandi.net | Gandi CLI tool]] (optional) ===== Setup Instructions ===== ==== Instance configuration ==== If you haven't already, create an instance : $ gandi paas create --type phpmysql --name paas_name Attach an address as a vhost (example: //piwik.domain.tld//): $ gandi vhost create --piwik.domain.tld paas_name ==== PHP configuration ==== Piwik requires a specific option to be set in your custom-php.ini file in order to install correctly. Connect to the SSH console: $ gandi paas console paas_name Then edit the file /srv/data/etc/php/custom-php.ini and add the following line : always_populate_raw_post_data=-1 Save the file, exit from the console, and then reboot the instance for the changes to take effect. $ gandi paas reboot paas_name ==== Database configuration ===== Next we'll create a database named //piwik//, a database user named //piwik// with password //CHANGE_ME//, and assign privileges for the user to the database. Connect to the SSH console : $ gandi paas console paas_name Login to the MySQL command-line environment and run the following commands : $ mysql -u root -p mysql> CREATE DATABASE piwik; Query OK, 1 row affected (0.01 sec) mysql> CREATE USER piwik; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON piwik.* to 'piwik'@'localhost' identified by 'CHANGE_ME'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> quit ==== Deploy code ==== On your local computer, clone the empty git repository associated with the vhost : $ gandi paas clone --vhost piwik.domain.tld paas_name Download the piwik installation files into the htdocs folder : $ cd piwik.domain.tld $ wget http://builds.piwik.org/piwik.zip $ unzip piwik.zip $ mv piwik htdocs Commit the changes and deploy the code : $ git add . $ git commit -am 'First commit of piwik installation' $ git push gandi master $ gandi deploy ==== Install Piwik ==== * Navigate to the vhost address in a web browser, for example : %%http://piwik.domain.tld%% * Click //Next// * Verify all system requirements are met, then click //Next// * Enter in the database details: * **Server Address**: localhost * **Login**: piwik * **Password**: CHANGE_ME * **Database Name**: piwik * Click //Next// * Create a Super User account for Piwik, then click //Next// * You will be prompted to enter in the first website address you would like to track analytics for. Enter in the required website information and then click //Next// * Lastly, you'll be provided with Javascript tracking code to insert into the website At this point you've installed and configured Piwik for tracking website analytics. You'll need to add the Javascript code provided by Piwik into the webpages you wish to track. When those webpages are then visited by end-users, the Javascript code will send the analytics details to your Piwk installation. For more details on configuration and optimizing Piwik, please refer to their [[http://piwik.org/docs/ | documentation]]. ===== Additional reading ===== * http://piwik.org/docs/ * http://piwik.org/docs/installation/ * http://piwik.org/docs/installation-optimization/