Follow PHP Analytics on Twitter
We are looking for beta tester. If you are interested, please contact us and give a short description of your business.

Installation Guide

1. Introduction

PHP Analytics is a WordPress plugin that transforms your WordPress platform in a reporting tool; therefore, you need the WordPress platform  in order to use PHP Analytics.

2. Requirements

In order to install and use successfully PHP Analytics, make sure your domain meets the following requirements:

  • WordPress 3.0.2 or higher installed (refer to the official documentation)
  • MySQL 5 database (or higher version)
  • PHP 5 (or higher version)

3. Pre installation tasks

3.1 Download the software

Make sure you have downloaded and extracted the following archives:

  • phpanalytics.zip
  • phpanalytics_tinymce_chart.zip
  • phpanalytics_tinymce_table.zip

The softare is available in this page.

3.2 Edit plugin’ settings [optional]

Open with an editor the phpanalytics/settings.php file and modify the parameters where needed by following the advices below. Take care: you should not change these parameters once the product is installed, otherwise it won’t work anymore.

Variable Type Values
$analytics_sql['tname']['databases'] string Name of the table that stores database connections
$analytics_sql['tname']['queries'] string Name of the table that stores your queries
$analytics_sql['tname']['tables'] string Name of the table that stores your table views
$analytics_sql['tname']['charts'] string Name of the table that stores your chart views
$analytics_sql['tname']['cols'] string Name of the table that stores your table view’s column metadata
$analytics_sql['tname']['chart-cols'] string Name of the table that stores your chart view’s column metadata

3.3 Upload the software

Upload the extracted archives into the WordPress wp-content/plugin directory.

4. Activate the plugin

In the WordPress administration panel, select the PHP Analytics plugins and activate them.

If everything is fine, you will see a new Analytics menu and 2 more buttons in your TinyMCE editor.

5. Post Installation tasks

5.1 Modify your template’s header.php file

This task can be considered optional if you are not planning to publish views within an iFrame.

If you plan to publish your views within an iFrame, you have to import jQuery in your template’s header.php file in order to use the iFrame Auto Resize plugin.

To import jQuery, modify your current template’s header.php file by adding the following line just before the function wp_head():

wp_enqueue_script("jquery");

You can do this trough the WordPress Administration panel, as shown below.

5.2 Modify your template’s CSS styles

This task is kindly recommended especially if you are not planning to publish your views within an iFrame.

Table views styles are usually affected by WordPress template styles due to style properties propagation. If you are not planning to manually fix this problem, the fastest solution is too delete all the table styles properties that occur in your default template’s CSS files; be aware that this could affect the content of your blog whenever you have used an HTML table.

An example is shown below:

Please take care to remove everything’s about table, tbody, thead, tfoot, th, tr and td HTML tags.

5.3 Move view.php to your domain root folder [optional]

PHP Analytics provides a page view.php that is used to share your views across the web. It’s recommended to do not leave this page inside the PHP Analytics plugin directory; therefore it’s better to move it in your domain root folder so that it can be accessible trough the following URL: http://www.mydomain.com/view.php

In order to achive that, moving the file to your domain root folder is not enough. You need to edit the following parameter in the phpanalytics/settings.php file.

Variable Type Values
$analytics_url['iframe']['src'] string HTTP path to your view.php file (e.g. http://www.mydomain.com/view.php)

Then you have to edit the view.php file itself by updating the includes paths:

include_once('../../../wp-load.php');
include_once('includes.php'); 

If you have moved the view.php file in your WordPress root installation directory, the includes should look as follows:

include_once('wp-load.php');
include_once('wp-content/plugins/phpanalytics/includes.php');