Code for detecting US/non-us visitors - here it is

Discussion in 'Affiliate Programs' started by umpahpah, Mar 31, 2009.

  1. #1
    Maybe somebody needs that, for CPA offers - show USA only offers to USA visitors and some international offer for all the other.
    You place this code right below starting body tag

    <script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script> 
    HTML:
    and in the place where you want to show banner, put this code

    <script language="JavaScript"> 
    var country_code = geoip_country_code();
    if (country_code == "US"){
    document.write('PUT_YOUR_USA_OFFER_HTML_HERE');
    }else{
    document.write('PUT_YOUR_INTERNATIONAL_OFFER_HTML_HERE');
    }
    </script> 
    HTML:

    it can detect other countries as well, but you need to replace "US" with appropriate country code.

    uptime for server that hosts geoip javascript code is about 99.95% so I guess it's pretty reliable
     
    umpahpah, Mar 31, 2009 IP
  2. kmofo

    kmofo Active Member

    Messages:
    442
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    85
    #2
    seems to be reliable, but as far as I see on their webpage, it's not free. They have a limit of 25 queries / day unless you get some kind of subscription...
     
    kmofo, Mar 31, 2009 IP
  3. umpahpah

    umpahpah Well-Known Member

    Messages:
    266
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #3
    can you post text where they mention that?

    i've put this code on one site few hours ago and had few hundred pageviews since then and it looks like it's working without any problems
     
    umpahpah, Mar 31, 2009 IP
  4. kmofo

    kmofo Active Member

    Messages:
    442
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    85
    #4
    kmofo, Mar 31, 2009 IP
  5. umpahpah

    umpahpah Well-Known Member

    Messages:
    266
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #5
    maybe so..

    i've found this code on some other site that I can't manage to find again.
    they didn't mention any limitations
     
    umpahpah, Mar 31, 2009 IP