Results 1 to 7 of 7

Thread: How to Show Different Ads to Different Countries?

  1. #1

    How to Show Different Ads to Different Countries?

    Anyone have a simple way to switch on US vs non-US traffic on a WP post for what Advertisements to show? I have one affiliate offer that pays well, but only on U.S. traffic. Unlike other affiliate companies, they do not kick the clicker to an offer available for their country though instead they throw a 404 error...

    The two methods that come to mind are on load vs on click, just don't know how to switch on the country of origin for what Ad to show or destination URL to serve (either will work).


  2. If you use Maxminds geolocation API and write a custom php module that calls it and checks for the IP located in US or not, then serves the ad accordingly you should be able to do it all at the server level.

    If you need a script drawn up for you feel free to ask and I can give you a quote Auto Approval Proxy List Free Text File Hosting

  3. #3
    Hi, take a look at this page for more info:
    MaxMind - GeoIP Resources

    And from that page there's a free WP plugin here: » Jon’s Geolocation Plugin

    That WP plugin uses GeoIP city database though, you might want to swap that around to use the country database from maxmind instead. Maybe Codename_b can help you sort that out.


    There's also this WP plugin:

    WP GeoLocation
    This plugin uses the MaxMind GeoIP JS Web Service to return the Country, Region, City, Latitude, and Longitude WordPress shortcodes.

    More info on how to use it:

    It's javascript based, so kinda useless if people have disabled scripts in their browser, or don't use a browser to access your site content.


    Some random stuff:
    How to detect user’s country/language – the simple way |
    Geo Targeting Plugin � WordPress Plugins
    WordPress GeoTargeting Plugin ::
    Last edited by Mike-XS; 17 February, 2011 at 21:51 PM.

  4. Thanks Mike

    Yeah Maxmind's PHP stuff is REALLY useful ^^ thanks for showing it to me in the my blockscript thread btw, it really helped alot, I now have a fairly good understanding of the API

    @Javanx3d I'd definately go for something server side for the ads, for speed reasons too.

    If you want to display a message to users using adblock, I have a handy javascript for that that I'm more than happy to share with you free Auto Approval Proxy List Free Text File Hosting

  5. #5
    @codename_B definitely interested in the script Thanks for all of the info too! Of the 15 or so different offers on the site, just this one appears to not switch based on the country IP, but converts at a fairly high rate so figure why waste the non-US traffic!

  6. If you're going to go that far, you might want to look into going all the way to OpenX.
    Submit Your Webmaster Related Sites to the NB Directory
    I swear, by my life and my love of it, that I will never live for the sake of another man, nor ask another man to live for mine.

  7. @javanx3d if you want a simple @require('libs/adserving.php'); solution to your problem, I could have that knocked up for you by Monday at the latest. If you wanted me to do that for you, $10-15 would be all I'd need to get it all set up and running for you.

    The adblock code works by utilising a "false positive".

    You have the page javascript as valueX = 0;
    and you have an external javascript file that you call with a false querystring with all sorts of ?ad_id=24353&pub_id=43535&ads=142535 etc.

    In this javascript is a value that overrides valueX (so you put it after the first bit in the HTML. valueX = 1;

    Then you just run an onpageload checker that checks to see if valueX = 1, and if it doesn't, redirects users OR displays a popup informing them that they're hurting your site by using adblock.

    You can also use the <noscript> tag to redirect users using adblock or display a floating DIV informing them of hurting your revenue etc. Auto Approval Proxy List Free Text File Hosting

Similar Threads

  1. How to block certain countries
    By Newbie191 in forum Web Proxies
    Replies: 5
    Last Post: 1 December, 2009, 16:11 PM
  2. GeoIP tutorial - block countries..etc
    By Keldorn in forum Programming
    Replies: 0
    Last Post: 22 September, 2009, 08:58 AM
  3. How many countries you have visited?
    By DotComBum in forum General Chat
    Replies: 25
    Last Post: 9 September, 2009, 04:39 AM
  4. Which Countries?
    By Aytac01 in forum General Chat
    Replies: 7
    Last Post: 11 May, 2009, 19:53 PM
  5. What countries do you recommend blocking?
    By A12Alex in forum Web Proxies
    Replies: 5
    Last Post: 17 February, 2009, 15:03 PM

Tags for this Thread


Posting Permissions

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