Web Analytics

NEWS & TIPS

  • Site Access Keys
  • Top: Alt+t
    Previous: Alt+,
    Next: Alt+.
    Up: Alt+;
    (Note: use Ctrl on the Mac)

Web Analytics

Author: Andy Gardner

1. Introduction

This guide will quickly walk you through how to install and configure web analytics for your site. It assumes that you have a recent version* of PHP installed on your web server and that you are comfortable with Cascade. Knowledge of PHP is also useful, but not necessary to use this guide.

*You must have PHP 5 or later.  Only those versions support SimpleXML, which is required for this widget to operate.

2. Components

There are very few components to web analytics, and each one is fairly simple.  When a visitor accesses a web page within your site, their username, IP address, time of visit, and the page they visit are all recorded in a block in the CMS.  The data from this block can then be used to generate a visual representation of the data, which is useful in determining where they frequently visit.

The components are as follows.

3. Web Analytics Configuration

The web-analytics-config-data-def.xml file contains the XML necessary to create the data definition that is used to make the web analytics configuration file.  The CMS URL is just that—the URL for your CMS.  The CMS Directory field is where the web-analytics XML block will be placed.  The 'Username' and 'Password' fields are what is used to log in to the CMS and update its content.  Use the default values of these fields to guide your input.

4. Web Analytics Include

The XML in this file shows what your web-analytics-include XML block should look like.  Adjust the values of the 'include' and '$configpath' so that they point to the web-analytics.php and web-analytics-config files respectively.  Attach this block to a region on the page, and make sure the page has a php extension on publish so that the code will be executed.

5. Web Analysis

The web-analytics.php file contains the code that analyzes the user's visit to the page and updates both the web-analytics-users and web-analytics-pages blocks in the CMS.  The blocks are placed in the directory specified by the configuration file under the name 'web-analytics-users' and 'web-analytics-pages'.

6. Viewing Results

The 'web-analytics-top-users' stylesheet, when paired with the 'web-analytics-users' block, generates an HTML table showing the total number of page visits the ten most active users have made.  The users are ranked in descending order.

The same is done for the pages.  The 'web-analytics-top-pages' stylesheet uses the 'web-analytics-pages' block to show the ten most active pages in the site.

The 'web-analytics-all-users' stylesheet uses the user's block to create a table showing how long each user spent on each page.

7. Setup and Use

  1. Import all of the files into your CMS.  The XML for the data definition should be used to create those data definition.  The include block should be created using the XML from the web-analytics-include.xml file.  It does not matter where you place the PHP script.
  2. Create a page for your configuration file.  Use the data definition you just made.
  3. Adjust the content of the include block so it matches your CMS.
  4. Attach the include block to a region on your page.
  5. Make sure that when you publish the file extension is php.

Web Analytics Files

  1. web-analytics-php.txt
    This is the main PHP script that processes visitors to the website.
  2. web-analytics-all-users.xsl
    This XSL filters the XML to display all users that have browsed the site.
  3. web-analytics-config.xml
    This is an example XML configuration file.
  4. web-analytics-config-data-def.xml
    This is a data definition to visually configure the XML config file.
  5. web-analytics-include.xml
    This is a simple XML Block used to include the PHP code.
  6. web-analytics-top-pages.xsl
    This XSL filters out and displays the most visited pages.
  7. web-analytics-top-users.xsl
    This XSL filters out and displays the most active users.
  8. web-analytics.zip
    This zip file contains all the necessary scripts and XML.
Last modified on Mon, 30 Oct 2006 12:47:42 -0500

Top / Up / Table of Contents