[Contribution] Leapfrog - Dynamic Visitor Tracking
#1
Posted 16 February 2007, 09:14
Contribution available from: http://www.oscommerce.com/community/contributions,4891
--------------------------------------------------
What is Leapfrog?
--------------------------------------------------
Leapfrog is a refreshing way to look at the behaviour of visitors in your store. It lets you see what people are looking at on your site in realtime in a graphical format.
DEMO AVAILABLE AT:
http://www.oscommerce-tips.com/leapfrog/Leapfrog.html
Leapfrog can:
* Be installed in minutes, like any other contribution
* Update automatically - no need for constant page refreshes
* Be a more visual and fun way to track visitors
--------------------------------------------------
How It Works
--------------------------------------------------
Think of Leapfrog as a ladder. Recent visitors are at the top of the ladder, older visitors are at the bottom.
Whenever a visitor interacts with your site they are moved from their current position to the top of the ladder. When a visitor stops clicking, they gradually slide down the ladder as more recent visitors battle for the top spot!
The last three clicks for each visitor on the ladder are displayed, along with their IP address, total number or clicks, refering URL and total time on your site.
#2
Posted 16 February 2007, 10:21
any ideas on what i am doing wrong?
thanks
Sandbag, on Feb 16 2007, 09:14 AM, said:
Contribution available from: http://www.oscommerce.com/community/contributions,4891
--------------------------------------------------
What is Leapfrog?
--------------------------------------------------
Leapfrog is a refreshing way to look at the behaviour of visitors in your store. It lets you see what people are looking at on your site in realtime in a graphical format.
DEMO AVAILABLE AT:
http://www.oscommerce-tips.com/leapfrog/Leapfrog.html
Leapfrog can:
* Be installed in minutes, like any other contribution
* Update automatically - no need for constant page refreshes
* Be a more visual and fun way to track visitors
--------------------------------------------------
How It Works
--------------------------------------------------
Think of Leapfrog as a ladder. Recent visitors are at the top of the ladder, older visitors are at the bottom.
Whenever a visitor interacts with your site they are moved from their current position to the top of the ladder. When a visitor stops clicking, they gradually slide down the ladder as more recent visitors battle for the top spot!
The last three clicks for each visitor on the ladder are displayed, along with their IP address, total number or clicks, refering URL and total time on your site.
#3
Posted 16 February 2007, 10:28
thanks
#4
Posted 16 February 2007, 10:44
MePha, on Feb 16 2007, 10:28 AM, said:
thanks
Can you please try this:
Goto 'catalog\admin\includes\leapfrog' and rename 'leapfrog.swf' to 'Leapfrog.swf' (capital L instead of lowercase).
Let me know if it works and I'll update contribution.
Thanks,
Ed
#5
Posted 16 February 2007, 14:16
Love this contribution. Although it doesn't display the product images when you use Ultimate SEO urls.
Started to modify some of the code so that I can see which language the page is. I would also like to see the country they are from and if it is a spider or not. But I guess I'll figure this out soon.
Thanks for this great contribution!
abra
Feedback and suggestions on my shop welcome.
Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.
#6
Posted 16 February 2007, 14:35
Having the country displayed is a great idea and the language of the page. I'll see what I can do. The other feature I want to add is the ability to show what's in the user's shopping basket.
Edited by Sandbag, 16 February 2007, 14:36.
#7
Posted 16 February 2007, 14:42
To display the page language I just added a field to the database table and stored the $language_id. Then it's just a matter of adding it to the page title.
abra
Feedback and suggestions on my shop welcome.
Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.
#8
Posted 16 February 2007, 17:36
I love this contrib.
Could someone add the country of provenience based on the IP ?
something like:
require(DIR_WS_INCLUDES . 'geoip.inc'); $gi = geoip_open(DIR_WS_INCLUDES . 'GeoIP.dat',GEOIP_STANDARD);
and then:
<td class="dataTableContent" valign="top"><?php
if (geoip_country_code_by_addr($gi, $whos_online['ip_address'])) {
echo tep_image(DIR_WS_FLAGS . strtolower(geoip_country_code_by_addr($gi, $whos_online['ip_address'])) . '.gif', geoip_country_name_by_addr($gi, $whos_online['ip_address'])) . ' ' . geoip_country_name_by_addr($gi, $whos_online['ip_address']);
} else {
echo TEXT_UNKNOWN_COUNTRY ;
}
?></td>
thanks again
#9
Posted 16 February 2007, 17:42
// Insert all the information we have gathered into the database
$current_time = time();
if ($skip_tracking[$wo_ip_address] != 1) {
$insert_query = "insert into leapfrog" .
" (customer_id, customer_name, session_id, ip_address, click_time, page_url, page_title, referer_url)" .
' values ("' . $wo_customer_id . '", "' . $wo_full_name . '", "' . $wo_session_id . '", "' . $wo_ip_address .
'", "' . $current_time . '", "' . $wo_last_page_url . '", "' . $page_desc . '", "' . $referer_url . '")';
tep_db_query($insert_query);
}
}
to this :
// Insert all the information we have gathered into the database
$current_time = time();
[b] if ($wo_session_id > 0 ) {[/b]
if ($skip_tracking[$wo_ip_address] != 1) {
$insert_query = "insert into leapfrog" .
" (customer_id, customer_name, session_id, ip_address, click_time, page_url, page_title, referer_url)" .
' values ("' . $wo_customer_id . '", "' . $wo_full_name . '", "' . $wo_session_id . '", "' . $wo_ip_address .
'", "' . $current_time . '", "' . $wo_last_page_url . '", "' . $page_desc . '", "' . $referer_url . '")';
tep_db_query($insert_query);
}
[b] }[/b]
}
#10
#11
Posted 16 February 2007, 21:39
#12
Posted 16 February 2007, 22:19
acidvertigo, on Feb 16 2007, 09:39 PM, said:
Glad you're enjoying it!
At the moment Leapfrog DOES NOT delete the data in the database. You have to do that manually by clicking the 'Purge Database' button.
Here is an option I could include - only track visitors when the Leapfrog UI is open. This might work. I will try and include it in the next release.
In the meantime, if you are worried about the table becoming too large you might want to set up a CRON job to run every day that clears the leapfrog table. I don't know much about CRON but expect that would be possible (if your host supports it).
#13
Posted 16 February 2007, 22:20
Supertracker is found here: http://www.oscommerce.com/community/contributions,3924
Carine Bruyndoncx
KEUKENLUST, Everything but the kitchensink !
#14
Posted 16 February 2007, 22:31
Sandbag, on Feb 16 2007, 11:19 PM, said:
At the moment Leapfrog DOES NOT delete the data in the database. You have to do that manually by clicking the 'Purge Database' button.
Here is an option I could include - only track visitors when the Leapfrog UI is open. This might work. I will try and include it in the next release.
In the meantime, if you are worried about the table becoming too large you might want to set up a CRON job to run every day that clears the leapfrog table. I don't know much about CRON but expect that would be possible (if your host supports it).
forgot to tell you that i'am running this contrib on IIS server (impossible the CRON job) on a old 2003 snapshot ( pre MS1 era ). I can't se also the images, but not a problem for me.
But i like your idea to track users only when the UI is open.
#15
Posted 16 February 2007, 22:53
bruyndoncx, on Feb 16 2007, 10:20 PM, said:
I hadn't considered this. Have had a quick look at supertracker and think it would be possible
#16
#18
Posted 16 February 2007, 23:34
Find
// Get the product image if on product item page
$pattern = "/products_id=[0-9]+/";
preg_match($pattern, $row['page_url'], $matches);
$productPage = $matches[0];
$productId = substr($productPage, strpos($productPage, "=")+1);
if ($productId == "") {
$thumbUrl = "";
} else {
$itemQuery = "select products_image from products where products_id=" . $productId;
$itemResult = mysql_query($itemQuery);
$item = mysql_fetch_object($itemResult);
$thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item->products_image;
}
and replace with// Get the product image if on product item page
$pattern = "/p-[0-9]+/";
preg_match($pattern, $row['page_url'], $matches);
$productPage = $matches[0];
$productId = substr($productPage, strpos($productPage, "p-")+2);
$productId = str_replace (".html", '', $productId);
if ($productId == "") {
$thumbUrl = "";
} else {
$itemQuery = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id='" . $productId . "'");
$item = tep_db_fetch_array($itemQuery);
$thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item['products_image'];
}
abra
Feedback and suggestions on my shop welcome.
Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.
#19
Posted 17 February 2007, 00:06
Thank you for this contribution.
I have uploaded the files successfully and the visits are recorded in the leapfrog table.
But when I want to display the leapfrog and after few moments I get a popup window which states
"Unable to connect to your store database"
The store is running on Freebsd with MYSQL and PHP4, any ideas where to start looking ?
Thanks,
Simon
Edited by cbx040, 17 February 2007, 00:09.
#20
Posted 17 February 2007, 02:31
I'm using this one instead:
// Get the product image if on product item page
$pattern = "/p-[0-9]+/";
preg_match($pattern, $row['page_url'], $matches);
$productPage = $matches[0];
$productId = substr($productPage, strpos($productPage, "p-")+2);
$productId = str_replace (".html", '', $productId);
if ($productId == "") {
$thumbUrl = "";
} else {
$itemQuery = "select products_image from products where products_id=" . $productId;
$itemResult = mysql_query($itemQuery);
$item = mysql_fetch_object($itemResult);
$thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item->products_image;
}
Edited by Tomcat, 17 February 2007, 02:32.














