Make Money With Wordpress

Dynamically Generate Users Location On Landing Pages

What? An offer only available if I live in:

Hey, that’s me…sign me up!

Making a user think they’re looking at a local company or offer is an old trick that typically meant you’d have to download and install a location database and then call it using php/perl. Well, not anymore. Part of Google’s AJAX API is a geolocating service. It loads fast + barely takes up any space….great for testimonials or redirected users to specific pages based on their location. It’s a well established marketing theory that consumers will always feel more secure (i.e. more likely to open their wallets up) with someone they can relate to. What’s an instant way to relate to all your customers regardless of how big of an affiliate scum-bag you are? By making them think you’re both from the same city.

It might be a few miles off for some locations and give you the city next door, but over-all it’s pretty spot on and a great little tool that’s only a few lines of code. Best of all, you don’t need any type of Google developer key as it’s not tied to any specific website (i.e. you don’t need to register the site for it to work). Enjoy

Here you go:

1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript" 
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
if (typeof(google.loader.ClientLocation.address.city) != null) {
  document.write(google.loader.ClientLocation.address.city
  +", "
  +google.loader.ClientLocation.address.region);
} else {
  document.write("Unknown location")
}
</script>

Posted in Free Code at November 17th, 2008. Trackback URI: trackback
Tags: , , ,

2 Responses to “Dynamically Generate Users Location On Landing Pages”

  1. January 17th, 2009 at 8:39 pm #Suzie

    Thanks for the code..I have been looking for such a simpler version!

  2. February 2nd, 2009 at 4:30 pm #Ricardo

    are you portuguese man ? if so contact me, hehe

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word