views:

45

answers:

4

Hi if i like to track and get all the possible info about users that downloading my application without forcing them to register
what is the best php script for this ? or the best method to mange downloads?

+1  A: 

If you do not want to register them, all you can get is:

  • IP address
  • Browser info
  • System (computer) info
  • Time of downloading.

To get IP of the user in PHP, use this:

 $IP = $_SERVER['REMOTE_ADDR'];

Then you can use GeoIP tools to get their country or city, if you wish.

And for getting browser info in PHP, use get_browser().

shamittomar
A: 

Here is an open source project written in php and javascript that does exactly that: http://www.warefeed.com

Pierre 303
+2  A: 

This is a perfect use-case for Google Analytics Event Tracking. It's fairly easy to implement, though you'll need an Analytics account (obviously). Here's some sample code in jQuery.

$(function() {
    $('#myDownloadLink').click(function() {
        var tracker = _gat._getTracker('UA-xxxxxx-x'),  // get the analytics tracker - your UA code
            href = this.href,  // get the href - the file downloaded
            page = location.pathname.toLowerCase();

        tracker._trackEvent(page, 'download', href); // tracks the event
    });
});

Using GA allows you to access your analytics from everywhere, and gives you a decent set of filtering tools as well. Actually, if you wanted more detailed information, you could track it as a pageview instead of (or as well as) an event:

tracker._trackPageview('/download/' + href); // tracks as a page view

You could even prepend the current page to that, in order to tell where the download came from. You'll get information about browser, operating system, screen resolution, country of origin, and more.

Ryan Kinal
A: 

+1 for Ryan Kinal's answer. I like the idea of using a already proven and working solution for this. Much less hassle than writing up something yourself.

If you don't want to use googles tools but something you have full control over yourself you can look into Piwik, a web stats tracker that provides similar functionality to google analytics, is written in php, open source and hosted on your own server. So only you have access to the collected data. Just as google it provides many graphs, stats and ways of tracking user movements trough your site.

http://piwik.org/

edorian