geo target your landing page the maxmind way

geo target your landing page

When you are optimizing your landing page, you would want to do geo targeting. Taking a simple dating ad for example,
ad1: Meet someone in your area today
ad2: Meet someone in Vancouver today

Replace Vancouver with where you are currently located, and the ad will instantly stand out, to you. If you are building your own landing page, this is definitely something you’d want to split test.
There are a few ways to accomplish this; I will introduce the easiest way today, which will require no server modules or software. It is a pure javascript solution.

Simply use the following code

 javascript |  copy code |? 
1
Meet someone in 
2
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
3
<script language="JavaScript">document.write(geoip_city());</script>
4
today

You could also display related geo information (like zip, state, country … ) in the following manner

 javascript |  copy code |? 
01
<br>Country Code:
02
<script language="JavaScript">document.write(geoip_country_code());</script>
03
<br>Country Name:
04
<script language="JavaScript">document.write(geoip_country_name());</script>
05
<br>City:
06
<script language="JavaScript">document.write(geoip_city());</script>
07
<br>Region:
08
<script language="JavaScript">document.write(geoip_region());</script>
09
<br>Region Name:
10
<script language="JavaScript">document.write(geoip_region_name());</script>
11
<br>Latitude:
12
<script language="JavaScript">document.write(geoip_latitude());</script>
13
<br>Longitude:
14
<script language="JavaScript">document.write(geoip_longitude());</script>
15
<br>Postal Code:
16
<script language="JavaScript">document.write(geoip_postal_code());</script>

The code segment above uses maxmind’s (a leading geo IP info provider) javascript library, and you can simply display the location of the user hitting your site with it. This is basically the quickest way you can incorporate geo targeted ad copies into your landing page that I can think of.

This is however not optimized for speed, so if you have large campaigns getting a ton of traffic, you may want to look at installing the binary geo file if the javascript solution is slowing down your page load time.
In this case, have a look at the following site: Maxmind PHP geo ip

There are examples in PHP how you would call Maxmind’s geo ip functions to display the users city, state, country, etc.

to success,

Share this page
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Diigo
  • RSS
  • StumbleUpon
  • Yahoo! Buzz
  • DZone
  • email
  • MySpace
  • Reddit
  • Slashdot
  • Tumblr
You can leave a response, or trackback from your own site.
  • marriagedotcom

    Hi there I'm trying this out on my site yet I want to show entire unique landing pages for specific IP addresses (more than just ads) does the above process still work? And I was checking out maxmind and is the data not free? Any help would be invaluable, thanks

  • http://www.imkazu.com ImKazu.com

    hey there,
    maxmind does offer a free API http://www.maxmind.com/app/php
    You could use the geo city light and its fairly accurate for most affiliate type LP purpose.

    Have a look at the example script here: http://geolite.maxmind.com/download/geoip/api/php…;
    you could basically show different LPs based on the country_code or country_name

  • Compound

    Kazu – Your posts are extremely useful! Much appreciated.

    In your experience, at what level of traffic would you run into an issue using the javascript solution?

  • http://www.imkazu.com imKazu – affiliate marketing

    hey there
    i used to run a site that got 30k/day .. and at that level, having the binary files on the server made sense.

    i still use the js version for many of my landers (even for ppv); I guess its time to switch over once you notice significant traffic/lagging

blog comments powered by Disqus