Results 1 to 7 of 7

Thread: How to Show Different Ads to Different Countries?

  1. #1
    javanx3d's Avatar
    javanx3d is offline Net Builder
    Join Date
    May 2009
    Location
    Germany
    Posts
    916
    Blog Entries
    1
    Thanks
    237
    Thanked 237 Times in 164 Posts

    How to Show Different Ads to Different Countries?

    Hi,
    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).

    Cheers,
    James

  2. #2
    codename_B's Avatar
    codename_B is offline PHP Coder
    Join Date
    Jan 2011
    Posts
    106
    Thanks
    9
    Thanked 14 Times in 11 Posts
    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
    http://find-new-proxies.com Auto Approval Proxy List
    http://uf6.info Free Text File Hosting

  3. #3
    Mike-XS's Avatar
    Mike-XS is offline XeroAgent
    Join Date
    Sep 2009
    Location
    OZ
    Posts
    209
    Thanks
    30
    Thanked 109 Times in 71 Posts
    Hi, take a look at this page for more info:
    MaxMind - GeoIP Resources

    And from that page there's a free WP plugin here:
    jonlee.ca » 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.
    http://wordpress.org/extend/plugins/wp-geolocation-js/

    More info on how to use it:
    http://www.siteground.com/tutorials/geoip/cms.htm

    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:
    IP Details: PHP Class with Example By Me
    How to detect user’s country/language – the simple way | de77.com
    Geo Targeting Plugin � WordPress Plugins
    WordPress GeoTargeting Plugin :: TheWordPress.net
    Last edited by Mike-XS; 17 February, 2011 at 20:51 PM.

  4. Thanked by:

    javanx3d (18 February, 2011)

  5. #4
    codename_B's Avatar
    codename_B is offline PHP Coder
    Join Date
    Jan 2011
    Posts
    106
    Thanks
    9
    Thanked 14 Times in 11 Posts
    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
    http://find-new-proxies.com Auto Approval Proxy List
    http://uf6.info Free Text File Hosting

  6. Thanked by:

    javanx3d (18 February, 2011)

  7. #5
    javanx3d's Avatar
    javanx3d is offline Net Builder
    Join Date
    May 2009
    Location
    Germany
    Posts
    916
    Blog Entries
    1
    Thanks
    237
    Thanked 237 Times in 164 Posts
    @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!

  8. #6
    Will.Spencer's Avatar
    Will.Spencer is offline Retired
    Join Date
    Dec 2008
    Posts
    5,034
    Blog Entries
    1
    Thanks
    1,010
    Thanked 2,329 Times in 1,259 Posts
    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.

  9. Thanked by:

    javanx3d (18 February, 2011)

  10. #7
    codename_B's Avatar
    codename_B is offline PHP Coder
    Join Date
    Jan 2011
    Posts
    106
    Thanks
    9
    Thanked 14 Times in 11 Posts
    @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.
    http://find-new-proxies.com Auto Approval Proxy List
    http://uf6.info 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, 15: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, 14:03 PM

Tags for this Thread

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
  •