SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Detecting the country of the visitor?

    I'm currently writing a script for picking out targeted CJ (or other affiliate network) merchants from a database, and displaying them to the user. It selects the sponsor depending on different factors, such as
    • whether the user has been interested in this category before
    • what article the user is reading
    • What the user has thought of this category before (There will be thumbs-up and thumbs-down buttons on the sponsor-box


    I will release this script on hotscripts for free when it is done.

    Anyway, I need a little help - I want to target this script based on country. To achive this with reasonable error magin, I was thinking about a combination of detecting the domain, the OS language, and the timezone. If the country cannot be determined, international-only sponsors will be displayed.

    I know how to get the domain (GetHostByAddr($REMOTE_ADDR)), however, I have no idea if it's possible, and if so, how, to detect the users OS language? Would this require javascript?

    Also, I'm not sure how to detect and make use of the time zone? Any suggestions?

    I will greatly appriceate any help!
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  2. #2
    Wanna-be Apple nut silver trophy M. Johansson's Avatar
    Join Date
    Sep 2000
    Location
    Halmstad, Sweden
    Posts
    7,400
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    OOPS

    Whoops - 30 seconds after posting, I find the language variable:
    $HTTP_ACCEPT_LANGUAGE

    Well, only the timezone thingy left - any takers?
    Mattias Johansson
    Short, Swedish, Web Developer

    Buttons and Dog Tags with your custom design:
    FatStatement.com

  3. #3
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    You can go to weberdev.com and search for "country". I haven't look at those little scripts, so I don't know if it's any helpful to you.

    John


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
  •