
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,
October 24th, 2010
kazu
Posted in
Tags: 














