Tracking file downloads? How to please

Discussion in 'PHP' started by NRLMedia, Nov 6, 2006.

  1. #1
    Is there any way via code it can list how many times a file has been downloaded or clicked?
     
    NRLMedia, Nov 6, 2006 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    If you use google analytics they have a code you can use to track link clicks. Otherwise you will most likely need some sort of javascript tag to track clicks on specific links.
     
    jestep, Nov 6, 2006 IP
  3. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #3
    javascript isn't needed. the download link could be site.com/download.php?id=3 or something along those lines. they click on the link, which redirects to the file. inside the php file you would record the details where it is you want; mysql, flat file, etc.
     
    disgust, Nov 7, 2006 IP
  4. KC TAN

    KC TAN Well-Known Member

    Messages:
    4,792
    Likes Received:
    353
    Best Answers:
    0
    Trophy Points:
    155
    #4
    Yes, pretty much like what disgust has mentioned.

    Assuming clicking the download link will prompt:

    
    /* download.php */
    
    // connect and increment record in database
    
    //direct to the file for download
    header("http://www.secret.com/topsecret.pdf"); 
    
    PHP:
     
    KC TAN, Nov 7, 2006 IP