Posts Tagged ‘scripts’

Dynamically Generate Users Location On Landing Pages

 |  Free Code  |  2 comments

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:

<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>
Quietaffiliate userping