Book Image

Piwik Web Analytics Essentials

By : Stephan A. Miller
Book Image

Piwik Web Analytics Essentials

By: Stephan A. Miller

Overview of this book

<p>Without web analytics, you are blind on the internet. In order to improve conversions and revenue on your web- site, you need to know what is going on. Piwik gives you this data and unlike Google Analytics, gives you total control over its usage. Unlike Google analytics where the data can be read by Google, Piwik maintains complete confidentiality of your website data. By harnessing the power of your tracked data, you can raise the conversion rates on your website to new heights.<br /><br />"Piwik Web Analytics Essentials" will show you how to install Piwik Open Source Analytics and have you tracking your website’s visitors within an hour after you pick up the book! After that, you will learn how to track custom events and programmatically trigger tracking events. The book continues with ecommerce tracking and advanced Piwik API usage.<br /><br />This book will take you from installing Piwik on your web server to writing custom tracking code for your apps.<br /><br />You will learn goal and event tracking techniques and how to add them to your standard tracking to fine tune your analytics results. Nothing is untrackable using Piwik: ecommerce shopping carts, web apps, phone apps, and more can make use of Piwik tracking capabilities.<br /><br />"Piwik Web Analytics Essentials" will walk you through every step with detailed screenshots and plenty of example code.</p>
Table of Contents (18 chapters)
Piwik Web Analytics Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Creating a database for your installation


Now it's time to create the MySQL database and admin user that your Piwik installation will be using. It is recommended that you create a user and database specifically for Piwik to use to keep your MySQL users and databases segregated.

Creating a user and database for Piwik in cPanel

Create a user and database for your installation, using the following steps:

  1. 1. Open your browser, browse to the location of your cPanel installation, and click on the MySQL Databases link in cPanel.

  2. 2. Enter a name for the database you will be using for Piwik, and click on the Create Database button. If you are on shared hosting, cPanel will add your username as a prefix. For example, if you chose piwik as the name of your database and your username is username, the actual name of the database created will be username_piwik. You will need to remember this database name for the web-based Piwik installation.

  3. 3. Now it's time to create a user and assign the user to our new database. Jump down to the MySQL Users section. Enter your desired username and password twice, and click on Create User. You will need to remember the username and password for the Piwik installation. With cPanel on a shared host, you will get a new MySQL username with your username as a prefix, like this: username_mysqluser.

  4. 4. Now add the user to the database, by clicking on the Add button.

  5. 5. Next, check the ALL PRIVILEGES checkbox for the user and click on the Make Changes button, so that the new user gets full control of the new database.

Creating a user and database for Piwik with phpMyAdmin

Some web hosts provide you with an installation of phpMyAdmin with your hosting account, and other hosts may give you a way to install phpMyAdmin with a one-click installation process. In either case, here is how we create a user and database in Piwik using phpMyAdmin:

  1. 1. Navigate to the folder where phpMyAdmin is installed. The location of this installation depends upon your hosting provider or the directory you choose in the phpMyAdmin one-click installation process.

  2. 2. Click on the Databases link.

  3. 3. There, you should see a textbox with the words Create new database. Enter the name of your database in the box and click on the Create button.

  4. 4. Now that your database exists, it is time to create a user. Click on the More link on the far right-hand side of the upper menu. This will bring up another menu. One of the items in that menu will be Privileges. Click on that link.

  5. 5. When the page loads, click on Add a new User.

  6. 6. Enter a username, a password, and the same password again, in their designated boxes. Below that, in the Database for user section, make sure Grant all privileges on database "Your_Database_Name" is checked, where Your_Database_Name is the database you just created.

  7. 7. Click on the Go button at the end of the page. Once the page loads, you are done with the creation of a database section.

Creating a user and database for Piwik with SSH

For those of you who would rather use SSH to create your database for Piwik, you can use the following steps:

  1. 1. Log in to your web server via SSH, using Putty or Terminal.

  2. 2. Connect to the MySQL server, using the following command:

    mysql -u root –p
    

    In this command, root is a MySQL user with full permission.

  3. 3. You will be prompted for this user's password. Enter it.

  4. 4. Run the following command:

    CREATE DATABASE piwik;
    

    In this command, piwik is the name of the database you are creating.

  5. 5. Run this command:

    GRANT ALL ON piwik.* TO piwik_user@'localhost' IDENTIFIED BY 'password';
    

    In this command, piwik_user is the MySQL username you choose and password is the password you choose for that user.

Your database will be ready, but you may have to run the last command for all the possible host names you will be using. You will also need to run the last command for localhosts such as 127.0.0.1, and the domain your Piwik installation will be running under, if any.