Oct 07, 2008, 02:25 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: [Snippet] BBClone statistics to your site  (Read 7873 times)
0 Members and 1 Guest are viewing this topic.
doze
Coding Team
*
Posts: 3,109


....Boom!


« on: Mar 28, 2006, 02:25 PM »

Hi, I've made a snippet what gets some of the bbclone stats to your site (click to see bbclone in action). This is an ongoing project, I'll try to get the totals page done next and after that (done), I will try to make these more template driven.

The output of this snippet is pretty configurable in the current state too. Here's some instructions how to get this done:

First you need to install BBClone:

  • 1. Download BBClone from http://bbclone.de/download.php
  • 2. Download newest IP2EXT from http://bbclone.de/download.php?sub=ip2ext
  • 3. Extract both packages and copy the new ip2ext folder inside the bbclone folder overwriting old files
  • 4. Upload the bbclone directory to your webserver (can be anywhere you want)
    • NOTE: You can rename the bbclone folder if you want!
  • 5. CHMOD all files inside bbclone/var/ to 0666, exept .htaccess file!
  • 6. Paste the following code to the bottom of modx index.php (tried to do this as a plugin but did not succeed, could someone help?)
    • NOTE: Edit the $bbclone_path to point to your bbclone folder!
Code:
$page_title=$modx->documentObject['pagetitle'];
$bbclone_path=$modx->config['$base_path']."bbclone/";
define("_BBC_PAGE_NAME", "$page_title");
define("_BBCLONE_DIR", $bbclone_path);
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);
  • 7. Configure BBClone to work the way you want by editing the file bbclone/conf/config.php (ie. count only unique visitors, hide config information, etc) Read the manual about configuration settings at http://help.bbclone.de/index.php?n=Config.HomePage

After you have installed BBClone, go and visit your site and then point your browser to the bbclone url (ie. www.somedomain.com/bbclone). You should see your visit details in bbclone now.

Now to the snippets:

With the attached snippets, you can get the time stats and global stats of bbclone to your page. The code is pretty much the same as show_time.php and show_global.php in bbclone and I really can't take any credits of it. I just modified them to work as a snippet and made some css changes so you can customize the look of it to fit your desing.

There are some configuration setting at the start of the snippets. They are commented and it should be clear how to use them, but feel free to ask if you have any problems!

Snippet Installation:

bbclone_show_time
  • 1. Copy the content of bbclone_show_time.txt to a new snippet and name it
  • 2. Change the paths at the start of the snippet to point to correct locations
  • 3. Change the graph print sizes (if needed)
  • 4. Copy the content of bbclone_show_time.css to the HEAD of your template or to your css file (but edit out the <style> tags if you put it in a external css file)
  • 5. Change the colors in the css to fit your color scheme, there are comments to tell what class is for what
  • 6. Call your snippet in some document and see the results

bbclone_show_global
  • 1. Copy the content of bbclone_show_global.txt to a new snippet and name it
  • 2. Change the paths at the start of the snippet to point to correct locations
  • 3. Set the other configurable values to be the same as in bbclone config file
  • 4. Call your snippet in some document and see the results (uses same css as the snippet above)

If you are an advanced user, you can easily modify the whole output of the snippets by changing the return strings of them.. the functions returns content in tables. That's it for now..  Smiley

EDIT: Added show_global, you should reload the show_time snippet also, made some slight changes.

* bbclone_show_time.css (1.24 KB - downloaded 309 times.)
* bbclone_show_time.txt (9.92 KB - downloaded 336 times.)
* bbclone_show_global.txt (13.92 KB - downloaded 373 times.)
« Last Edit: Mar 29, 2006, 05:13 AM by doze » Logged

MODxWiki || Please, list wiki worthy material here!
davidm
Marketing & Design Team
*
Posts: 6,651


The best way to predict the future is to invent it


WWW
« Reply #1 on: Mar 28, 2006, 07:09 PM »

Doze : thanks a LOT for this one... I love BBClone, much more features than Slimstat, but still lightweight and I am used to it...

I'll test this as soon as possible and report, I am really excited about this snippet !
Logged

blog.nodeo.net : Pour un web libre, moderne et ouvert! :: | ! Nouveau ! Les forums modxcms.fr : Participez à l'élaboration du site MODx francophone ! ! Nouveau ! :.

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)

Réalisations sous MODx : nodeo.net | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | sworld.com | soleil.info
 et 3 autres en cours de réalisation Smiley
doze
Coding Team
*
Posts: 3,109


....Boom!


« Reply #2 on: Mar 29, 2006, 05:14 AM »

Added the bbclone_show_global snippet..
Logged

MODxWiki || Please, list wiki worthy material here!
Leftblank
Sr. Member
****
Posts: 253


Not as empty-brained as you'd think.


WWW
« Reply #3 on: Dec 07, 2006, 02:38 PM »

Kicking this one to the top, as it's still not in the repository, and imho it's way better than slimstat as you can actually show it nicely on the frontend.

Has anyone got a little hint on how to form this code into a plugin? The fileedits aren't ideal with all my upgrading on MODx...
So far I've tried using the code on kinda like all the possible web events, but it didn't turn out to work, sadly.
« Last Edit: Dec 07, 2006, 02:48 PM by Leftblank » Logged

PaulGregory
MODx's midnight runner
Moderator
*****
Posts: 1,095

MODx's midnight runner


WWW
« Reply #4 on: Dec 07, 2006, 07:07 PM »

Hmmn. Really there should be a suitable plugin point for this, but I don't know what it is. Editing index.php isn't a great deal of hackery though. Thanks for bringing this up though, it's just what I needed for something.
Logged

No, I don't know what OpenGeek's saying half the time either.
MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
Forum: Where to post threads about add-ons | Forum Rules
Like MODx? donate (and/or share your resources)
Like me? See my Amazon wishlist
MODx "Most Promising CMS" - so appropriate!
Samuele
Full Member
***
Posts: 112



« Reply #5 on: Dec 23, 2006, 08:46 AM »

Is there an authentication system for bbclone?
Logged

_______________________________________ ____________________________
..:: Samuele ::..
Leftblank
Sr. Member
****
Posts: 253


Not as empty-brained as you'd think.


WWW
« Reply #6 on: Dec 23, 2006, 10:38 AM »

Nope, you could protect its directory with a .htaccess or similiar thing though, but I don't see how that is useful, simply picking an uncommon name should do as well Wink
Logged

adias
Jr. Member
*
Posts: 14


« Reply #7 on: Jan 15, 2007, 07:49 PM »

Hi Doze! I installed BBClone at my site www.amdias.com but i've found that IE users were marked as Netscape... I went to BBClone forum, but no one knew the problem.

So i've found that in index.php of MODx there was this piece of code:
Code:
$_SERVER['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? preg_replace("/[^A-Za-z0-9_\-\,\.\/\s]/", "", $_SERVER['HTTP_USER_AGENT']): '';
$_SERVER['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? preg_replace($modxtags,"", $_SERVER['HTTP_REFERER']) : '';

Because of this convertions, BBClone, called at the end of the index.php can't work properly.

The only way to BBClone work without problems is doing something like this:
Code:
$HTTP_USER_AGENT = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';

Before

Code:
$_SERVER['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? preg_replace("/[^A-Za-z0-9_\-\,\.\/\s]/", "", $_SERVER['HTTP_USER_AGENT']): '';
$_SERVER['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? preg_replace($modxtags,"", $_SERVER['HTTP_REFERER']) : '';

Finaly, at the end of index.php:
Code:
$_SERVER['HTTP_USER_AGENT'] = $HTTP_USER_AGENT;
$_SERVER['HTTP_REFERER'] = $HTTP_REFERER;

$page_title=$modx->documentObject['pagetitle'];
$bbclone_path=$modx->config['$base_path']."stats/";
define("_BBC_PAGE_NAME", "$page_title");
define("_BBCLONE_DIR", $bbclone_path);
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);


And thats it! I hope this will be usefull to someone!
Sorry my english, regards,
ADias
« Last Edit: Jan 15, 2007, 07:52 PM by adias » Logged
PaulGregory
MODx's midnight runner
Moderator
*****
Posts: 1,095

MODx's midnight runner


WWW
« Reply #8 on: Jan 16, 2007, 04:40 AM »

adias, that's excellent. I only tried BBClone briefly and wondered why a lot of Netscape users seemed to be hitting my site - I'll try these instructions later and hopefully it will make a difference.
Logged

No, I don't know what OpenGeek's saying half the time either.
MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
Forum: Where to post threads about add-ons | Forum Rules
Like MODx? donate (and/or share your resources)
Like me? See my Amazon wishlist
MODx "Most Promising CMS" - so appropriate!
doze
Coding Team
*
Posts: 3,109


....Boom!


« Reply #9 on: Jan 16, 2007, 11:26 AM »

Yea, thanks for that.. I'm a bit unimpressed with bbclone after I have been using it for a while.. It seems that it somehow finds a way to corrupt it's own data files and then the whole logging breaks.. Have anyone else had that? When I clear the data files, it works for some time, but then I start to get this error message randomly on my pages:

Quote from: error message that bbclone produces
Parse error: syntax error, unexpected $end, expecting ')' in /www/path/to/modx/bbclone/var/last.php on line 109

I looked littlebit of the code that is used to write the data files (mark_page.php) and it looks that they have tried to do some semaphores to that to prevent writing the file more than one times simultaneously, but either it's not working in my server enviroment or something else is failing with it... anyways, I'm not going to develop this further because of that.

I've been looking at Google Analytics and hoping that they do some api to it.. that would rock.
Logged

MODxWiki || Please, list wiki worthy material here!
Pete
Full Member
***
Posts: 110


« Reply #10 on: Jan 17, 2007, 03:46 AM »

Doesn't look like they do at the moment unfortunately: http://adwords.google.com/support/bin/answer.py?answer=27257&topic=8133
Logged
Leftblank
Sr. Member
****
Posts: 253


Not as empty-brained as you'd think.


WWW
« Reply #11 on: Jan 17, 2007, 07:21 AM »

Yea, thanks for that.. I'm a bit unimpressed with bbclone after I have been using it for a while.. It seems that it somehow finds a way to corrupt it's own data files and then the whole logging breaks.. Have anyone else had that? When I clear the data files, it works for some time, but then I start to get this error message randomly on my pages:

Quote from: error message that bbclone produces
Parse error: syntax error, unexpected $end, expecting ')' in /www/path/to/modx/bbclone/var/last.php on line 109

I looked littlebit of the code that is used to write the data files (mark_page.php) and it looks that they have tried to do some semaphores to that to prevent writing the file more than one times simultaneously, but either it's not working in my server enviroment or something else is failing with it... anyways, I'm not going to develop this further because of that.

I've been looking at Google Analytics and hoping that they do some api to it.. that would rock.
I've been running it for a month or two now and no corruption yet, I must say my website isn't too heavily accessed, just about 300-600 pageviews a day.
Logged

doze
Coding Team
*
Posts: 3,109


....Boom!


« Reply #12 on: Jan 17, 2007, 03:57 PM »

I've been running it for a month or two now and no corruption yet, I must say my website isn't too heavily accessed, just about 300-600 pageviews a day.
It looks that it's pretty common issue though.. I did a quick search in their forums and some thread said that it's about some bug in old php versions, but my server runs 5.2.0 so that can't be it.. Another thread said that it's about running it on Windows, but my server runs on linux. So don't know what that's about, but I guess it's some enviroment thing..
Logged

MODxWiki || Please, list wiki worthy material here!
edipo
Sr. Member
****
Posts: 319



« Reply #13 on: Jan 18, 2007, 08:09 AM »

Hi. I'm using bbclone but it doesn't say any pages in the "Top 10 Visited Pages".
I'm using Furls.
Logged

Sorry for my bad English  Grin
adias
Jr. Member
*
Posts: 14


« Reply #14 on: Jan 18, 2007, 03:05 PM »

Check if the page_title is passed to BBClone correctly... This is done in the instruction:

Code:
define("_BBC_PAGE_NAME", "$page_title");

You may use echo instruction to see what you have in the $page_title variable.
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!