IP GeoloactionAre you missing out on traffic from “other countries”? With just few simple scripts and a free GEO IP database from MaxMind, you can identify visitors that are not from you primary county, and show them AdSense ads!

Let’s say you have an e-commerce site or a lead gen site, that is targeted for traffic from a specific country (US, UK, whatever), but you also get healthy traffic from countries that you do not sell to. Right now those visitors come to your site, see that they cannot buy from you and leave, while you are not making anything.

I have a site like that – it is targeted to US visitors only, but 27% of my traffic is international. For the last 36 months I’ve been losing 27% of my potential earnings because international site visitors did not see any ads.

My site is primarily focused on LEAD Generation in the United States, and foreign visitors are of no “interest”. But recently I installed a Geo Location based on IP, which can determine the originating country of the visitor, and show them AdSense ads instead of my Lead Gen widgets.

NOTE: If you have questions or suggestions on Geo Location based monetization, leave a comment below.

How does IP Geolocation Work:

Basically, every web user has an IP address, which is unique for them. I will leave out VPNs and Proxy people – because those are few and far between and will typically not be interested in our services. But 95-99% of visitors are normal people, going online to research something.

Each IP address includes the COUNTRY of the visitor, and if you have the right tools, you can identify where the visitors come from and show them “targeted” ads.

How do I show AdSense ads to international visitors:

First – whenever a visitor comes to my website, I run a script to determine the COUNTRY CODE of the user, by initiating a free GEO-IP database from MaxMind (a leader in IP GeoLocation).

Next – I run a simple PHP if/else script which determines what “ad” to show.

IF user is from US – show LEAD GEN ad.

ELSE – show AdSense ad.

It’s that simple. I use only one variable (Country Code) and each user sees a specific ad.

The GeoLocation DB that I use is Geoip2 Lite which you can download for free here.

If you don’t know how to setup GeoLite2 or have issues making it work, you can seek help on StackOverflow Geolite page.

You can use either the COUNTRY or CITY version of the database, but the biggest issue is to actually set it up. I had to use help from my freelance programmer, as this level of PHP coding is beyond my skill level.

How to use GeoLite to determine user’s Country:

Once you set up the GeoLite database, you can use the simple PHP codes below to show appropriate ads to a specific user, based on country.

1 – Load the GeoLite DB

What I do is put a simple PHP include command at the top of my WordPress Theme header.php file

include 'geolite/geolite.php';

This includes GeoLite2 db located in geolite folder inside my WP theme.

Next, where I show ads, I run another script, where I check if user is from US or ANY other country.

global $country;
if ($country == 'US')

NOTE: All code below goes inside PHP open/close brackets.
NOTE 2: the line with global $country; uses a global variable, which I “make” Global in the GeoLite config file. Here “global” means that I can use the $county variable anywhere on the site, and don’t need to load GeoIB db every time I need to see where user came from.

NOTE 3: WordPress acts weirdly with GeoLite2, but not with GeoIP2 (a paid API version of DB which I also use and pay for, when I need better accuracy on city level). The essence of this weird behavior is that when you INCLUDE geolite, you need to give it ABSOLUTE PATH to the folder inside your WP theme. Otherwise it will not load properly!

Here is the example of my ABS PATH:

$reader = new Reader(ABSPATH . 'wp-content/themes/GOV/geolite/maxmind-db/GeoLite2-City.mmdb');

How Much can you make from “International” site visitors?

So far I’ve been running this GeoIP based ad showing on only one page as a test, and had only 9000 page views – therefore there is no concrete data to report. I did not do a full roll out until today as I was… busy 🙂 …

However, today I setup new Ad Units and Custom Channels and added “international” adds on ALL desktop pages on my site. I also “removed” all lead generation for out-of-country users, so they don’t get confused. I will also add the GeoIP ads to the mobile version of my site.

I will run this for about a month and post updated information on how much I’ve earned from so far unmonetized 27% of my site traffic.

However, if most of YOUR traffic is from US and you want to monetize international traffic, you can expect the International RPM (revenue per 1000 visitors) to be 50-60% lower than US RPM – this is based on my data for 2016.

What this means in real numbers: If your US RPM is $10, then your combined international RPM will be about $4-5.

If you have 100,000 monthly visitors from outside US, you will make about $400-500 based on $4-5 RPM… But since each site is different – these numbers will vary. However – if you did not earn ANYTHING from foreign visitors before – you can add a few hundred to few thousand every year to your bottom line!

Best of luck – let me know what you think, and come back in the end of Aug. 2016 for my update on how much I made from international visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *