propellerads adcombo
Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

How to insert geo location banner?

Discussion in 'General Affiliate Marketing Forum' started by maurosicard, Oct 10, 2014.

  1. maurosicard

    maurosicard Affiliate affiliate

    2
    0
    1
    Hello friends,

    I want to insert some different banners in a WordPress site, but I want to be different banners depending on the country.

    Is there a way to do this? ,

    Thank you very much
     
  2. crysper

    crysper Moderator moderator Service Manager affiliate

    Maybe there are some plugins that will do it much better than this, but I'll give you a code which should work.
    Put this on the header of your page(inside the <head> tag):
    <script src="http://j.maxmind.com/app/geoip.js"></script>

    Put this exactly where the banner should be placed:
    <script>
    var banner={};
    banner['default']='<a href="banner link when you click on it"><img src="default banner source" /></a>';
    //banner['default'] is the banner for the visitors who are from countries that are not in the banner list below

    banner['US']='<a href="banner link when you click on it"><img src="US banner source" /></a>';
    banner['FR']='<a href="banner link when you click on it"><img src="FR banner source" /></a>';
    //....use the same pattern for the countries you need

    var country_code=geoip_country_code();

    if(banner[country_code]!=null)
    document.write(banner[country_code]);
    else
    document.write(banner['default']);

    </script>
     
    Last edited: Oct 10, 2014

Featured Resources (View All)

adsxposed