Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

[Contribution] Leapfrog - Dynamic Visitor Tracking


181 replies to this topic

#1 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 09:14

This is the official Leapfrog support thread.

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 caliguy1973

  • Community Member
  • 9 posts
  • Real Name:ezra

Posted 16 February 2007, 10:21

I installed this mod, but when i click on leapfrog in my admin and launch it, it shows me a blank screen. But when i look in my mysql database my leapfrog table has refering stats in there.

any ideas on what i am doing wrong?

thanks


View PostSandbag, on Feb 16 2007, 09:14 AM, said:

This is the official Leapfrog support thread.

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 MePha

  • Community Member
  • 1 posts
  • Real Name:Uwe Merbeth

Posted 16 February 2007, 10:28

I have the same problem, any ideas on what i am doing wrong?

thanks

#4 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 10:44

View PostMePha, on Feb 16 2007, 10:28 AM, said:

I have the same problem, any ideas on what i am doing wrong?

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 abra123cadabra

  • Community Member
  • 853 posts
  • Real Name:Ulrike
  • Location:Dublin

Posted 16 February 2007, 14:16

Replacing leapfrog.swf with Leapfrog.swf in /catalog/admin/includes/leapfrog/leapfrog.html does the trick.

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
The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

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 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 14:35

Yes you're right about the images. The contribution parses the URL to extract the product id, which can then be used to find the image. If you have a contribution installed that changes the URL then this won't work.

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 abra123cadabra

  • Community Member
  • 853 posts
  • Real Name:Ulrike
  • Location:Dublin

Posted 16 February 2007, 14:42

I'm working on the image issue if Ultimate SEO urls are installed.

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
The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

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 Tomcat

  • Community Member
  • 192 posts
  • Real Name:-
  • Gender:Male
  • Location:Tuscany - Italy

Posted 16 February 2007, 17:36

Hi,

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
Outside links in signatures are not allowed!

#9 Tomcat

  • Community Member
  • 192 posts
  • Real Name:-
  • Gender:Male
  • Location:Tuscany - Italy

Posted 16 February 2007, 17:42

I also made the script discard all the hits without a session_id ( robots, mainly ) changing this bit of code:
// 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]
   }

Outside links in signatures are not allowed!

#10 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 18:41

View PostTomcat, on Feb 16 2007, 05:36 PM, said:

Could someone add the country of provenience based on the IP ?

Definitely needed. Added to my TODO list :thumbsup:.

#11 acidvertigo

  • Community Member
  • 132 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 16 February 2007, 21:39

Hi, beautiful contribution. Just one question, Leapfrog can delete data stored after a defined time? I ask this beacause i see the leapfrog table in mysql database increase in size and i don't want taht the size of this table waste all mysql space.... :'(

#12 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 22:19

View Postacidvertigo, on Feb 16 2007, 09:39 PM, said:

Hi, beautiful contribution. Just one question, Leapfrog can delete data stored after a defined time? I ask this beacause i see the leapfrog table in mysql database increase in size and i don't want taht the size of this table waste all mysql space.... :'(

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 bruyndoncx

  • Community Member
  • 2,307 posts
  • Real Name:Carine Bruyndoncx
  • Gender:Female
  • Location:Belgium/ Antwerp/ Turnhout/ Arendonk

Posted 16 February 2007, 22:20

This is a fun tool to watch :) but before adding another tracking application adding more database queries, I'd like to know if it could plugin what I already have. To me it seems all data currently shown, as well as requested is tracked in the supertracker contribution. Have you looked at or considered plugging in leapfrog into that database table ?
Supertracker is found here: http://www.oscommerce.com/community/contributions,3924
Hava a nice day !
Carine Bruyndoncx

KEUKENLUST, Everything but the kitchensink !

#14 acidvertigo

  • Community Member
  • 132 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 16 February 2007, 22:31

View PostSandbag, on Feb 16 2007, 11:19 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).

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. :rolleyes:

#15 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 22:53

View Postbruyndoncx, on Feb 16 2007, 10:20 PM, said:

Have you looked at or considered plugging in leapfrog into that database table ?

I hadn't considered this. Have had a quick look at supertracker and think it would be possible :). There are aspects of supertracker I would like to include in Leapfrog such as referer string and shopping basket contents. Let me have a more detailed look at that contribution and I will try and create a separate Leapfrog Plugin for it. However my main focus will be on building features into Leapfrog for people without supertracker.

#16 Sandbag

  • Community Member
  • 107 posts
  • Real Name:Ed
  • Gender:Male
  • Location:London, England

Posted 16 February 2007, 22:57

View Postacidvertigo, on Feb 16 2007, 10:31 PM, said:

I can't se also the images, but not a problem for me.

Do you have Ultimate SEO URLs installed? This causes the images not to show. Again, I am working on fixing this.

#17 acidvertigo

  • Community Member
  • 132 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 16 February 2007, 23:28

View PostSandbag, on Feb 16 2007, 11:57 PM, said:

Do you have Ultimate SEO URLs installed? This causes the images not to show. Again, I am working on fixing this.

No, i haven't But my images folder is different from conventional installation

#18 abra123cadabra

  • Community Member
  • 853 posts
  • Real Name:Ulrike
  • Location:Dublin

Posted 16 February 2007, 23:34

Here are the changes I made to /catalog/admin/includes/functions/leapfrog.php to work with Ultimate SEO urls:

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
The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

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 cbx040

  • Community Member
  • 27 posts
  • Real Name:Simon
  • Location:Northamptonshire, UK

Posted 17 February 2007, 00:06

Hi,
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 Tomcat

  • Community Member
  • 192 posts
  • Real Name:-
  • Gender:Male
  • Location:Tuscany - Italy

Posted 17 February 2007, 02:31

The change to the url parser made above by abra123cadabra wasn't working for me.
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.

Outside links in signatures are not allowed!