Results 1 to 6 of 6
  1. #1
    Member blizzard's Avatar
    Join Date
    February 8th, 2006
    Location
    Los Angeles
    Posts
    61
    PHP code to sniff foreign traffic
    Somebody must know how to do this...

    My site gets a substantial amount of non-US traffic. Anytime I serve an affiliate ad from a domestic merchant to these foreign browsers, it's effectively the same as a null page view--it's dead traffic.

    I'd like to put in a simple php script that sniffs for non-US Ip's and then serves AdSense to foreign traffic.

    Anybody know a decent way to generate the test?

    ie,

    if(test_for_foreign_traffic)

    {serve Adsense}

    else

    {serve US Affiliate link}

  2. #2
    Newbie
    Join Date
    May 23rd, 2005
    Posts
    21
    Wink Here you go
    http://software77.net/geoip-software.htm

    http://software77.net/cgi-bin/ip-country/geo-ip.pl

    Other people charge $150/year for this. Consider giving back in some way.

  3. #3
    Member blizzard's Avatar
    Join Date
    February 8th, 2006
    Location
    Los Angeles
    Posts
    61
    Thanks for the link. Having to regularly download and manage a database of IP numbers is a little more work than I was hoping for, but I'll save that as a maybe someday future project.

    A friend suggested just testing for the browser's language. That's an imperfect solution, but it would be a lot easier.

  4. #4
    Full Member iolaire's Avatar
    Join Date
    October 3rd, 2006
    Location
    Arlington, VA
    Posts
    229
    The openads ad server has geotargeting built in, with the base geotargeting datasets available for free. That would allow you to do what you want and give you even more power over the ads you serve. You only need the pay geotargeting databases if you want to get down to the state level.

  5. #5
    ABW Ambassador PatrickAllmond's Avatar
    Join Date
    September 20th, 2005
    Location
    OKC
    Posts
    1,219
    Don't want to butt in or hijack but what openads server are referring to? openads is something you download and install on your local machine.
    ---
    This response was masterly crafted via the fingers of Patrick Allmond who believe you should StopDoingNothing starting today.
    ---
    Focus Consulting is where I roll | Follow @patrickallmond on Twitter
    Search Engine Marketing | Search Engine Optimization | Social Media | Online Video

  6. #6
    Full Member iolaire's Avatar
    Join Date
    October 3rd, 2006
    Location
    Arlington, VA
    Posts
    229
    Quote Originally Posted by patrick24601
    Don't want to butt in or hijack but what openads server are referring to? openads is something you download and install on your local machine.
    A server that you run... on your site.

  7. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Need php code work
    By RH&A in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: March 21st, 2007, 08:03 AM
  2. Monitizing a high traffic site with foreign visitors.
    By Trilitech in forum Building Traffic, Newsletters & Advertising
    Replies: 4
    Last Post: February 15th, 2006, 10:21 AM
  3. php code
    By tvcrazyman in forum GoldenCAN
    Replies: 4
    Last Post: January 19th, 2006, 05:22 PM

Posting Permissions

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