Live Hits

10th Jan 2007 Danny

Plugin updated 24th Jan 2008 - Please ensure you have the latest version installed

The Live Hits plugin for b2evolution provides an automatically updating, live view of who is visiting your site. Once the plugin is uploaded and installed, go to the Tools tab, then the Live Hits sub-tab. JavaScript is required.

You can filter the hits by blog and by hit type (browser, rss, robot and unknown). For each hit, you can see which blog was visited, what url was visited, the referring url, if any and a logo for the user agent. Click on the logo to see the full user agent signature. The plugin tries to do a lookup on the IP address to see what city and country it's coming from.

If you fill in the Plugin setting for Google Maps API Key, then a map will be added to the Live Hits page, and new hits will be shown on the map (provided the IP lookup returned a latitude and longitude for the IP.) You can get an api key for your domain here.

The other plugin setting controls how often new hits are displayed. The default is every three seconds.

  1. Introduction
  2. Installation (v1.x+)
  3. Installation (v2.x+)


Comment from: EdB
Nice, but is there a way to bring the page out of the back office? Possibly a "disp=" type of thing, or a custom-crafted page that can be included in a bloglist? Plus google maps api tos says it's gotta be freely accessible to end users. I guess 'end users' isn't clear, but I figured that meant web browser users. Heck maybe it's only the 'freely' part that matters? Either way, I'd love to see this not hide in the back office.
01/10/07 @ 22:34
Comment from: Danny
I'm pretty sure that TOS just means that you can't charge for it. We've talked about doing some kind of front end version of this. I would want to think pretty hard about privacy concerns. You don't want to expose the IP address of your visitors and show the world where they are and what parts of your site they're looking at.
01/10/07 @ 22:47
I tried setting it up but , after installation, I would click on the "Live Hits" tab
but the plugin fails to load on the screen. It just sits there trying to load.

I have b2evo 1.8.5 (Firefox 2.0 & IE 6)

01/11/07 @ 02:14
Comment from: Danny
I developed this against 1.9.1, but I also tested with 1.8 and it works fine for me. Any information you can give would be helpful. How much of the page loads? Do you have error messages turned on? If so, do you see any errors? If you install the Firebug extension, does it report any javascript errors?
01/11/07 @ 02:38
I uninstalled it and re-installed it. Beautiful work you've done with this one.

Working in IT, I should've known the trick :-)

Thanks a lot for all the coding & typing. I know it is a lot of work.

01/11/07 @ 03:03
NIce one ! wonderful ! this plugin is great :) thanks a lot for this, it's just perfect !
01/11/07 @ 15:16
Comment from: John
Hi Danny...
B2 1.9.1 Error on installation..
SQL Version MYSQL (3.23.58)
PHP Version 4.3.11 (apache2handler)
An unexpected error has occured!

If this error persits, please report it to the administrator.

Go back to home page
Additional information about this error:

MySQL error!

You have an error in your SQL syntax near 'OFFSET 1' at line 11(Errno=1064)

01/11/07 @ 23:24
Comment from: Danny
Whoa, that's a seriously old version of mysql. 3.23 came out in 2001. I suspect that's your problem. Upgrade if you can, or if not, try removing the OFFSET 1 bit and it may work. I can't test that, but it's worth a try.
01/12/07 @ 00:37
Comment from: John
Thanks Danny
I'll try your suggestion. Yes, I have great host but they update with extreme caution :)
Will post the outcome
01/12/07 @ 00:42
Comment from: Khalid
I've just upgraded to 1.9.1 and I wanted to install you plug-in by following the instructions at the top of this page. But when I open the plug-in in the backoffice it does not show in the list of available plug-ins.

01/16/07 @ 18:53
Comment from: Danny
You probably just erased the livehits_plugin folder when you copied in the 1.9.1 plugins folder. Different ftp clients handle merging file trees in different ways. All you need to do is download the plugin and install it again.
01/16/07 @ 19:09
Comment from: khalid
No Danny, I uploaded the folder again and it still does show in the available skin list.
01/17/07 @ 06:30
Comment from: Ryan
Regarding John's post about the MySQL error - I had a smiliar experience. As Danny suggested I removed "OFFSET 1" (from _livehits_plugin.php) and everything appears to be working fine. Thanks! Hope that helps anyone else using an old version of MySQL.
01/18/07 @ 03:59
Comment from: Khalid
When I put the _livehits.plugin.php in the plugin folder and the livehits_plugin folder also I was able to install it. But it does not dhow googlemap even though I inserted the key and also no images for browsers and it shows the hit with unknown Country/City.

01/21/07 @ 09:51
Comment from: Khalid
Sorry if I hijack this topic. This is an additional problem to my previous but a message:

Recent Hits

You must enable JavaScript to see new hits.

Although JavaScript is enabled in my browser.
01/21/07 @ 10:20
Hi Khalid,
Damn, yer gonna be confusing the poor old plugin!

You might be best starting afresh, first uninstall any versions of the plugin in admin and then remove the live_hits_plugin folder and the _livehits.plugin.php from your plugins folder.

Then download a fresh copy of the plugin, just in case you have a corrupted file, and upload the whole livehits_plugin folder to your plugins folder (damn, that's way to many "plugins" in one sentance :p )

You should end up with /blog/plugins/livehits_plugin/_livehits.plugin.php as a file path.

Then hit admin and reinstall the plugin again and see if you continue to have problems.

01/21/07 @ 13:21
Comment from: Khalid
Thanks, now it works but the hitlist does not recognize my City or Country.

Instead it gives:

(Unknown City?), (Unknown Country?) (XX)
01/22/07 @ 07:24
Comment from: jeff
I tried installing but when I try to change the settings to put in the API key I get a 403 error. The error log reads:

[Mon Feb 12 22:08:45 2007] [error] [client xx.xx.xx.xx] mod_security: Access denied with code 403. Pattern match "((alter|create|drop)[[:space:]]+(column|database|procedure|table)|delete[[:space:]]+from|update.+set.+=)" at POST_PAYLOAD [id "300015"] [rev "1"] [msg "Generic SQL injection protection"] [severity "CRITICAL"] [hostname ""] [uri "/blogs/admin.php"]


02/13/07 @ 04:56
Comment from: Sanook
I wanted to install the plugin in b2evo 1.9.2 by following the instructions at the top of this page. But i cannot see it in the list of available plugins. I have uploaded the livehits_plugin-folder into the plugin-folder. What am i doing wrong?
02/25/07 @ 05:09
The only thing I can think of is that the plugin is nested to deeply.

Check the path to livehits.plugin.php it should resemble something like this /plugins/livehits_plugin/livehits.plugin.php

02/25/07 @ 10:56
Comment from: W^L+
It was working great until recently, when it suddenly started showing error messages and taking a long time to fill in the page.

Notice: Undefined offset: 1 in /plugins/livehits_plugin/_livehits.plugin.php in line 239 [repeated for 1, 2, 3, 4; lines 240, 241, 242, 243]
04/08/07 @ 03:48
Comment from: Danny
Thanks for reporting this. I fixed the bug and updated the zip file. If you download it and copy the files in the errors should go away. Please let us know if that fixed it.
04/08/07 @ 04:33
Installed the Livehits plugin, and all appears to be working as intended. Many thanks for a great plugin.

Cheers for now,
05/25/07 @ 10:42
Comment from: Klaas
Nice plugin you have made here! Do you know if there is also a plugin so I can show the googlemap in a post. and then mark the place where I am?
07/19/07 @ 22:23
Klaas, that is exactly what I was looking to do as well. I'm about to be renting a room & figured my blog would be a good place to put the primary listing.

Alos, this is another vote for a small version of this map in the sidebar of the blog. It would replace a map I used before I upgraded quite nicely.
08/10/07 @ 21:47
Comment from: brian
i installed it,
but u cant figure out how to add the map to any page, and also, i cant see where everyone sees the (Unknown City?), (Unknown Country?) (XX)...
i see nothing
under plugings tab i see installed.
i checked stats, i dont know how to get the info out of this plugin, i installed it the way the instrustions sayd, and also did a reinstall.

im lost
09/30/07 @ 20:31
Comment from: sims
Great litle plugin, appears to be working fine, a lot of hits from india?
When it picks my own hits up, I get "(Unknown City?), (Unknown Country?) (XX)"
I just wondered where and how these settings are poplulated?
Is it out of the users control?
04/12/08 @ 10:29
Comment from: tom
Sorry to bring this topic up again.
Got the latest b2evo 2.4.6 and installed this plugin.

It takes minutes until the page is displayed, then it is partially loaded and instead of the map the text "You must enable JavaScript to see new hits" is displayed. And then after another few minutes, suddenly the map is visible. But no hits are shown (well, only one marker at the center of the map) and I see an error message
"MySql server has gone away" during dbsave() - probably a timeout as it takes that long.

UPDATE evo_sessions SET
sess_data = 'a:1:{s:22:\"ItemList_filters_coll1\";a:2:{i:0;N;i:1;a:30:{s:13:\"filter_preset\";N;s:6:\"ts_min\";N;s:6:\"ts_max\";N;s:14:\"ts_created_max\";N;s:9:\"cat_array\";a:0:{}s:12:\"cat_modifier\";s:0:\"\";s:9:\"cat_focus\";s:4:\"wide\";s:4:\"tags\";N;s:7:\"authors\";N;s:9:\"assignees\";N;s:15:\"author_assignee\";N;s:2:\"lc\";s:3:\"all\";s:8:\"keywords\";N;s:6:\"phrase\";s:3:\"AND\";s:5:\"exact\";i:0;s:7:\"post_ID\";N;s:12:\"post_ID_list\";N;s:10:\"post_title\";N;s:6:\"ymdhms\";N;s:4:\"week\";N;s:10:\"ymdhms_min\";s:0:\"\";s:10:\"ymdhms_max\";s:0:\"\";s:8:\"statuses\";N;s:5:\"types\";N;s:16:\"visibility_array\";a:6:{i:0;s:9:\"published\";i:1;s:9:\"protected\";i:2;s:7:\"private\";i:3;s:5:\"draft\";i:4;s:10:\"deprecated\";i:5;s:10:\"redirected\";}s:7:\"orderby\";s:12:\"datemodified\";s:5:\"order\";s:4:\"DESC\";s:4:\"unit\";s:5:\"posts\";s:5:\"posts\";i:20;s:4:\"page\";i:1;}}}',
sess_ipaddress = '',
sess_key = 'SNZHFClFHViqoLREMClcLC7ikR0bSKHS',
sess_lastseen = '2009-02-06 09:06:13',
sess_user_ID = 1

WHERE sess_ID = 60266

Any ideas? Maybe removing the backslashes?
02/06/09 @ 08:09
Comment from: tom
found the problem:

$url = "$row->hit_remote_addr";

that domain is not reachable anymore
02/06/09 @ 12:07
Comment from: Joe

I've come across a couple of PHP errors when running this plugin on my server.
This is the diff to fix them:
diff -u _livehits.plugin.php.orig _livehits.plugin.php
--- _livehits.plugin.php.orig 2008-01-24 18:07:02.000000000 +0000
+++ _livehits.plugin.php 2009-03-26 18:17:37.000000000 +0000
@@ -372,9 +372,10 @@
$url_parsed = parse_url('http://'.$url);

- $port = $url_parsed["port"];
- if ( !$port ) {
- $port = 80;
+ if (empty($url_parsed['port'])) {
+ $port = 80;
+ } else {
+ $port = $url_parsed["port"];

$path = $url_parsed["path"];
@@ -397,6 +398,7 @@
$error .= $errstr;
return $error;
+ $body = "";
fwrite($fp, $out);
while (!feof($fp)) {
$s = fgets($fp, 128);
@@ -418,4 +420,4 @@

\ No newline at end of file

I also noticed that I only seem to get the last hot on the map. I haven't looked deeper into this yet, though.

03/26/09 @ 18:54
Comment from: Joe
Forget the "only one entry shown" on the map bit. Seems I was just too impatient.
03/26/09 @ 20:06
Hi there! Can you tell me, plese, whether this plugin is b2evo 3.3.1 compatible? I uploaded it to the plugin folder so I can find it under Customize/Blog Properties/Global Settings/Plugins. Over here it seem to be installed. So now I guess I should find it under the Tools tab, but there is no Live Hits sub-tab. Is there something that I miss?

Thank you for your attention!
10/09/09 @ 08:20
Hi there, I managed to solve the mistery. :P

I did found the plugin under Tools tab, in Live hits. Is just that I was looking for another Tools tab, the Admin one (the bar on the upper side of the page).

It is a nice plugin, dude. Someone else was asking the same thing before, is is any way to bring it on the blog, not only into the back ofice?

Thank you for the Live Hits! :)
10/09/09 @ 08:58
Comment from: NM
Works on 3.3.2
12/22/09 @ 17:29

Comments are closed for this post.