geo-targeting: the ultimate guide
DESCRIPTION
A step by step tutorial on how to use Lambda GeoIP to geo-target your users. Display a geo-targeted location, forward users based on physical location, or find the nearest major city to your users.TRANSCRIPT
Geo-targeting ScriptGeo-targeting Script: The : The Ultimate GuideUltimate Guide
Using Using Lambda Geo-target Lambda Geo-target and and others to determine the physical others to determine the physical
location of your visitorslocation of your visitors
What can be detemined with geo-What can be detemined with geo-targeting?targeting?
• Continent
• Country
• Region
• City
• Area code
• Postal code
• Latitude/Longitude
• ISP
How to Use How to Use Geo-targetingGeo-targeting on your on your Site (PHP)Site (PHP)
<?php
require(“geoip.php”);echo geoip_format(“%city, %region, %country) ;
?>
Will output:
Atlanta, Georgia, United States
If you lived in Atlanta, Georgia
Using Lambda Geo-target
How to Find the Nearest Major City How to Find the Nearest Major City Using Using Geo-targetingGeo-targeting
<?php
require(“geoip.php”);echo geoip_closest_format(“%city, %region”, 2000000) ;
?>
Will output:
Los Angeles, CaliforniaIf you lived in a small town near Los Angeles, California. geoip_closest_format() returns the closest city of 2,000,000 people or more, depending on what you specify.
Using Lambda Geo-target
How to Forward a User to a Different How to Forward a User to a Different URL Based on Location (pt 2)URL Based on Location (pt 2)
<?php
geoip_forward_region(“California”, “cali.html”);geoip_forward_country(“Georgia”, “ga.html”);geoip_forward_contient(“NA”, “na.html”);geoip_forward(“catchall.html”);
?>
This will forward California users first, then Georgia users, then will forward all other users in North America. Finally, all users who aren’t in the above groups will be forwarded to catchall.html.
Using Lambda Geo-target
How to display a Map with the How to display a Map with the User’s LocationUser’s Location
<script type="text/javascript"> if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_container")); map.setCenter(new GLatLng(<?php echo geoip_latitude . “, “ . geoip_longitude(); ?>), 6); map.setUIToDefault(); var point = new GLatLng(<?php echo geoip_latitude . “, “ .
geoip_longitude(); ?>); map.addOverlay(new GMarker(point)); } </script>
Using Lambda Geo-target and Google Maps
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=api_key" type="text/javascript"></script>
Put this somewhere after your <body> tag:
Put this in between your <head> and </head> tags:
Replace api_key with your Google Maps API key.
Replace map_container with the id of the <div> where you want the map to go. Replace the number 6 with the zoom level you want.
Displaying the User’s location on Displaying the User’s location on the Mapsthe Maps
The end result will look something like this. There are all sorts of neat things you can do with Google maps and the user’s location. Get creative.
How Does Geo-targeting help How Does Geo-targeting help SEO?SEO?
• Provides more relevant content to the user (Search Engines notice this)
• Localize text based on country and local terminology (Users will search for things as they are used to spelling it)
• Display local contact information to give a sense of locality
• Forward a user to a local site (e.g Forward UK users to mysite.co.uk)
Common MistakesCommon Mistakes• Don’t display the region for locations outside of the United States.
Most countries simply list the city in country (e.g. Milan, Italy). In the US, it is more common to display the city and state.
• If you are trying to convince the reader that you are in the same city as them, display the nearest major city. It is much more believable than to list a small town that the user may be from. Lambda Geo-target is currently the only script that can do this.
• Don’t forget to localize all aspects of a page. Don’t list your location as London, England and then have a picture of a major US city elsewhere on the page.
• If you are changing the language based on location, do not forget to give the user an easy option to switch languages. Many countries have multiple languages and not being able to easily switch will put off some users.
Don’t Forget to Update your Don’t Forget to Update your Database!Database!
• The physical location of IP addresses changes from time to time. Lambda Geo-target offers free database and script updates for life. Not updating can result in less accurate results.
Beware of JavascriptBeware of Javascript
• Using Javascript to display the geo-targeted data can be risky– Other website owners can use your script to
leech off your database, often without you knowing.
– Using Javascript can result in a lag time between the time the page is loaded and the time it is displayed and/or the user is forwarded.
Beware of Third Party APIsBeware of Third Party APIs
• If you are using a third party API to grab the geo-data, beware. These services can do down at any time and leave your site broken while your visitors will go elsewhere.
• Having to connect to a third party makes your page load slower.
You’re All Set!You’re All Set!
• Use Geo-targeting to:– Increase conversions– Increase CTR– Help users find other users close to them– Decrease the amount of time they spend
filling out forms– Improve overall user experience!