1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Website Visitor Tracking

Discussion in 'General Programming Chat' started by CodingMonkey, Jan 21, 2014.

  1. CodingMonkey

    CodingMonkey Newbie

    Jan 21, 2014
    Likes Received:

    So, I've been wanting to develop a leads tracking script. I've started with the basics, using cookies to find out the visitors' IP address and location.

    Here are the two things I'm curious about adding:

    1) Identifying Facebook accounts of website visitors who are logged into Facebook when they visit the site. I'm assuming I could use Facebook's API to get started...

    2) Identifying the visitors' names and email addresses using cookies. I know this would be difficult-impossible for residential IPs, but corporate IPs should be easy, right?

    I'm not asking for someone else to do the work lol, I just want some feedback and/or suggestions from more seasoned programmers. Thanks, guys!
  2. mypmmail

    mypmmail Junior Member

    Jan 31, 2008
    Likes Received:
    I'll try to see if I can answer your questions correctly.

    However, before that, I will try to explain a bit on the difference between getting ip information and getting cookie information.

    It is not difficult to get the ip information of the request (even though the information may be incorrect, i.e. through proxy) because this information is embedded in the request header.
    As for cookie, it is easy to find cookie information for those that is meant for your website, but not possible for domain that is not tied to your website.
    Thus, the assumption to get facebook cookie user information is easy only if you are facebook.
    The reason is in each cookie, there is a domain information tied to it.
    Thus, in the code itself, though you didn't specify, it will only allow you to get cookie that is for your domain.

    Your question may be, then why there are website that has facebook comments in it and can show user information?
    The reason is, you actually attached a facebook javascript into your webpage which actually creates an iframe to facebook.
    This iframe is essentially a showing a web page in facebook domain, and thus facebook can access user information cookies meant for the domain facebook.com

    There is another way of getting user information, which is creating a facebook app and get the user information through OAuth2.
    But, using this method will cause the page to prompt the user to grant the app to access the user information (which is through API and not cookie)
    Something like if you use feedly, it will prompt you to allow access to your g account.

    So, the answer to your question is actually, unless the user grant the access of those information to you either directly or through fb, g account (OAuth2), you can't just pluck it without the user knowledge.

    Oh, and there is the other way, which is to install a plugin (like toolbar) on the user browser. You can basically do anything you want if the user allows that.

    • Thanks Thanks x 1
    Last edited: Jan 21, 2014