Web Analytics Made Easy -
StatCounter tracking clicked links - CodingForum

Announcement

Collapse
No announcement yet.

tracking clicked links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tracking clicked links

    Suppose I have a mailing list and a database of everyone subscribed to the mailing list. How would I keep track of who clicked on a link from the email?

    I'm looking to have a database with all the information and who has been clicking,

    The most important issue is to find a way to distinguish the refferals,

    such as Dave Smith, with email [email protected] clicks on the link, i'm looking for a way to assign a variable with the unique information, or put it into a mysql table.

    I was thinking script.php?name=id1


    The script being what would proccess all the info. I was tring to figure out if I could store the refferals, and line each id up with the subscriber, I also tried using $PHP_SELF and assigning it to a variable. But the ?name=id1
    doesn't carry over.

    I am not an expert programmer by any means, any help would be greatly appreciated. Thanks

  • #2
    Welcome here !

    About the referer. Just have the link inside the mail point to a page on your server. And in that page read the referer
    Take a look here:
    http://www.php.net/reserved.variables
    You need the $_SERVER['HTTP_REFERER'] to get the referer (if any)

    For your querystringquestion, you can get it using $_SERVER['QUERY_STRING']


    But you should not use the referer, since that doesn't tell you anything about the user (except for which mailclien they use, and it would surprise me if mailclient send out the referer.)
    Anyway, a fair share of your users wount have a html-enabled mailclient and they would copy paste the url in the adressbar so there woul not be a referer.

    Using the querystring is much better. If you are concerned about people manipulating the querystring, then you could adda second variable like check=ezrfqer56zdq56 and store that random stringvalue inside the usertable.
    If you then have a querystring like
    uid=45&check=ezrfqer56zdq56
    then you can run a select on your usertable to validate the request like $sql="select count(*) as uservalidate from usertable where uid=" . $_GET['uid']." and randcheck='". $_GET['check'] ."'

    if the returned 'usevalidate' != 0 then they manipulated the querystring (or then the userrecord was deleted)
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

    Comment

    Working...
    X