BBClone is a nifty web counter written in PHP that gives a detailed view of the visitors your web site has, by displaying their IP, hostname, browser, OS, where they came from etc. It’s really easy to integrate with WordPress and it doesn’t need a database to run. You can see it in action here.

Installation

Assuming you have a shell account to your hosting provider (you should probably be able to follow these instructions using a FTP client that supports changing permissions to files/folders), get the latest zip package from the BBClone site and save it in your WordPress root directory:

cd /path/to/public_html/
wget http://bbclone.de/dist/bbclone-0.6.3.zip

Unzip it:

unzip bbclone-0.6.3.zip

Change permissions for bbclone directory to 775:

sudo chmod 775 bbclone/

Change permissions for directories inside the bbclone directory to 777:

sudo find /path/to/public_html/bbclone -type d -exec chmod 777 {} +

Change permissions for files inside the bbclone directory to 666:

sudo find /path/to/public_html/bbclone -type f -exec chmod 666 {} +

Edit the template-loader.php. This will track visitor no matter what theme you use for WordPress:

sudo nano /path/to/public_html/wp-includes/template-loader.php

Add this code right after the <?php (make sure you edit the path to bbclone)

if (is_home() == true) {
$pagetitle = "Home";
}
else {
$pagetitle = wp_title('', false);
}

define("_BBC_PAGE_NAME", $pagetitle);
define("_BBCLONE_DIR", "/path/to/public_html/bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) { include_once(COUNTER); }
else { echo "Counter is broken."; }

That should do it. Go visit your site and then yoursite.com/bbclone .

Troubleshooting

Just in case something goes wrong, here’s what you can do:

– create a test.php file in your WordPress directory:

sudo touch /path/to/public_html/test.php
sudo nano /path/to/public_html/test.php

– add this code into it:

<?php
define("_BBC_PAGE_NAME", "Test");
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
?>

– open BBClone config file

sudo nano /path/to/public_html/bbclone/config/config.php

– turn debugging on:

$BBC_DEBUG = "1";

Open your.site.com/test.php and see what’s wrong.

HowTo Integrate BBClone to WordPress
Tagged on: