Results 1 to 4 of 4

Thread: Link tracker with PHP

  1. #1
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default Link tracker with PHP

    Hi,

    Most of you know Google Adsense.. So I want to get information which users uses that links and how many times.

    It is possible to track that? (if user push google-adsense link in my webpage I will get info somehow. Who, which link, when, how many times)

    Thanks.

  2. #2
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    Is it even possible to do?

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    I did this a while back, and I may still have the files at home. I'll have a look later for you. Yes, it is possible, but I wouldn't want to write it from scratch. At it's core, it's a simple concept:

    1. When - Simply use date() in PHP
    2. Who - if you have members setup, then this is easy ($_SESSION['user_name']), otherwise you won't know, you could get IP though.

    3. The link - easy too, just take whatever is being clicked on from the href="" attribute. Or you could also perhaps use $_SERVER['HTTP_REFERER'] if you want to use a separate file.

    4. How many times - Check the database, if a record matching that link is in there already, increment the "views" or "hits" field, otherwise create a new record.

  4. #4
    Join Date
    Aug 2009
    Posts
    399
    Thanks
    42
    Thanked 4 Times in 4 Posts

    Default

    That would be really good. I would be even happy if I could save nick's who entered the links.
    Last edited by auriaks; 02-18-2010 at 01:38 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •