Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Leapfrog - Dynamic Visitor Tracking


Sandbag

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 181
  • Created
  • Last Reply

Top Posters In This Topic

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

 

 

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.... :'(

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Outside links in signatures are not allowed!

Link to comment
Share on other sites

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

 

If you have your images folder in a different location to the default installation then follow this procedure.

 

1. Open 'catalog\admin\includes\functions\leapfrog.php.

 

2. On line 90 find:

 

$thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item->products_image;

 

This normal resolves to something like /www/catalog/images/product_image.jpg. You will need to change this line to point to your images folder.

Link to comment
Share on other sites

If you have your images folder in a different location to the default installation then follow this procedure.

 

1. Open 'catalog\admin\includes\functions\leapfrog.php.

 

2. On line 90 find:

 

$thumbUrl = DIR_WS_CATALOG . DIR_WS_IMAGES . "/" . $item->products_image;

 

This normal resolves to something like /www/catalog/images/product_image.jpg. You will need to change this line to point to your images folder.

 

Yes, i tried it. But nothing. IN all the other contribution that i have DIR_WS_IMAGES is set correctly. :'(

Link to comment
Share on other sites

Yes, i tried it. But nothing. IN all the other contribution that i have DIR_WS_IMAGES is set correctly. :'(

 

Please can you try this to give me more information. Open your browser and navigate to:

 

http://www.yourdomain.com/catalog/admin/leapfrog_feed.php?action=newclicks&lastclick=1

 

When that page appears, view the HTML source. There you will see the XML data Leapfrog uses to animate visitors.

 

Look for a <thumburl></thumburl> tag and let me know what data string it contains. Some will be blank, but product info pages should contain the location of the image.

Link to comment
Share on other sites

Please can you try this to give me more information. Open your browser and navigate to:

 

http://www.yourdomain.com/catalog/admin/leapfrog_feed.php?action=newclicks&lastclick=1

 

When that page appears, view the HTML source. There you will see the XML data Leapfrog uses to animate visitors.

 

Look for a <thumburl></thumburl> tag and let me know what data string it contains. Some will be blank, but product info pages should contain the location of the image.

 

no <thumburl> and no <page url>

 

But ok for <pagetitle><visitorsid><visitorsname><refererurl><sessionid><visitorname><clicktime><visitorip> :blink:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...