I fixed my b2 blog to show referring pages from the permalink or comments view of a weblog entry.
Here are instructions for making this modification:
1. Download the refererlog code from:
http://ncyoung.com/code/zip/refererLib.zip
More info available at:
http://ncyoung.com/code.php
2. Edit refererLib.php, placing your database connection variables in the connect statements at the top of the file. If you want the library to ignore internal links (i.e. those from one page to another within your own site) you must add your domain to the "ignore" array. If there are other sites whose referrals you'd like ignored, you may add them to the "ignore" array as well.
3. Place the library in your b2 directory.
4. visit http://path_to_b2/refererLib.php?createTable=1 to create the database table to hold referers.
5. At the top of your main blog template, you should see a statement like:
include ("blog.header.php");
Right after this, add a statement:
include ("refererLib.php");
6. Again in your main blog template but much further down: Right before