BBClone is a great website statistics application that provides great insight into how visitors access and navigate your website. BBClone provides many useful statistics including:
- Visitor IP address
- hostnames
- operating systems
- robot visits
- browsers
- referring URL (where do they come from)
- visit date
- number of times a visitor has loaded each page
- number of visitors
- the visited pages in the order someone viewed them (bread crumbs)
- the last visited page
- the search engine query that lead to your site (if applicable)
- ranking of the most frequent countries, referrers, OS, browsers, robots, page views and hostnames
As you can see this application can provide you with invaluable information. Unfortunately for Joomla! users the component that was released to the Joomla! Extensions directory was removed because it did not work with Joomla! 1.5.x. Luckily for any developer with a bit of familiarity with PHP and the installation/organisation of Joomla! 1.5.x a simple core hack can give you the statistics you want from your website.
Software & equipment needed
- An FTP client (my personal favorite is the FileZilla FTP Client
- A Joomla! 1.5.x installation with FTP access to the server
- BBClone installation package
Installing BBClone
The first thing that we must do before integrating BBClone is to install it. This is quite simple to do and only takes these short steps.
- Download the latest package from the BBClone website (click here)
- Log into your website’s root via FTP
- Create a subdirectory in the root with a meaningful name. BBClone recommends using bbclone, but I recommend something else as there is no password protection on the application. We’ll use “webstats” for this example.
- Upload all the files into the newly created subdirectory “webstats”.
Thats it!
Integrate BBClone
As mentioned above to integrate BBClone with Joomla! 1.5.x you have to perform a core hack. The hack is simple and pretty much non-intrusive. In your Joomla! install directory download the index.php file (not your templates root) and make a backup of it.
Next open the index.php file in your favorite PHP editor and add the following lines at the bottom of the page.
/**
* BBClone statistics
*/
$juri = JURI::getInstance(); // get jURI instance to get SEF path
$uri = substr($juri->getPath(),1);
$uri = $uri == "" ? "index.html" : $uri;
// Extract the URI file part
defined("_BBC_PAGE_NAME") ? _BBC_PAGE_NAME : define("_BBC_PAGE_NAME", $uri);
define("_BBCLONE_DIR", JPATH_BASE . '/webstats/');
define("COUNTER", _BBCLONE_DIR. "mark_page.php");
if(is_readable(COUNTER))
{
include_once(COUNTER);
}
I personally like using the file name as my page describer, but this requires you to have Joomla! configured to generate such URL’s. As an alternative you can use the page title to uniquely identify your pages. To do so simply replace:
defined("_BBC_PAGE_NAME") ? _BBC_PAGE_NAME : define("_BBC_PAGE_NAME", $uri);
with
defined("_BBC_PAGE_NAME") ? _BBC_PAGE_NAME : define("_BBC_PAGE_NAME", $mainframe->getPageTitle());
// alternative to do the same as above
//$document =& JFactory::getDocument();
//define("_BBC_PAGE_NAME", $document->getTitle());
Validate your installation
Last thing we want to do is to verify that your installation is now functional. To do so point your favorite web browser at http://yoursite/webstats/ and voila you have a functional installation! If you are not seeing anything you may want to verify that you’re attempting to access the correct path you uploaded the BBClone files to.
The End
Reference BBClone’s website for details on configuring the application. Additionally I recommend you read about configuring Joomla! 1.5.x to produce SEF (Search Engine Friendly) URL’s.
If you have followed these basic steps you should soon begin to see statistics appear in your BBClone installation.
Hopefully this was helpful!