Using GeoSelect
GeoSelect provides two methods for incorporating geographical customization into web sites. These methods are:
- Geo Tags,
The Geo Tags are HTML style tags that are used just like any other HTML
tag. There are just 3 tags that need to be used and they are <geoselect>,
<geoif> and <geobytes>. These tags and their usage are explained
further here.
- Geobytes Headers.
The second method uses the Geobytes Headers. This method allows you to
access the geographical information at the server-side and use it with PHP,
ASP, Perl or any other kind of server-side script.
GeoSelect inserts the viewer’s
location into the HTTP headers before the request is passed to any applications. There
are more than 20 Geobytes headers to choose from. You can also use the
HTML-style <geo> tags in conjunction with the Geobytes Headers.
This page provides a brief overview of using both the Geo
Tags and Geobytes Headers.
It also provides basic code examples including:
More extensive code samples can be found at the Geobytes EpiCenter.
Lastly, this page also provides information on using the
built-in "geobytes location bar"
and how to determine a Location code.
There are only three basic geo tags that you need to understand to use
GeoSelect. They are <geoselect>, <geoif>, and <geobytes>.
- <geoselect> - used to group one or more <geoif> tags into the same decision block.
- <geoif> - There are three types of <geoif> tags, all of which are optional.
- <geoif [location]> Content will be displayed to visitors from the
specified location.
The location can be any number and / or combination of locations in the form
location="xxx". For example to target the content within the
<geoif> to San Francisco you would use
<geoif location="USCASFRA">
<p>San Francisco Content goes
here</p>
</geoif>
or to target to both San Francisco and London
<geoif location="USCASFRA,UKENLOND">
<p>Content for San Francisco
and London</p>
</geoif>
or to target all of California plus London and an area extending out to
100 miles around Chicago
<geoif location="USCA,UKENLOND,USILCHIC
–r 100mi">
<p>Content for all California
plus London,
plus within 100 miles of and including Chicago</p>
</geoif>
You can have as many <geoif> tags as you like within the same <geoselect>,
and as many <geoselect> blocks as you like on the same page.
geoif Tag Precedence
When processing <geoif> tags which 'geographically' overlap, (i.e. where one
tag may specify a city that is within another tag's region, or
country), GeoSelect will give
the tag with the finest granularity preference. So City has preference
over Region, and Region over Country.
<geoif>
tags can also contain geobytes tags. geobytes tags look like "<geobytes
city>" and are discussed further below.
- <geoif geodefault> Specifies the content that will
be served to visitors who's location is known, but does not match with any
<geoif> tag. This content may be further dynamically customized
based on the visitors location using geobytes tags, as in the above
example. <geoif geodefault> is the tag to use if you want to
add a welcome message like:
"Special welcome to visitors from <geobytes city>, <geobytes
country>."
- <geoif default> Specifies the content that will be
served to visitors where GeoSelect has been unable to determine their
geographical location.
<geobytes> - geobytes tags act as place holders for
dynamic content, and may appear anywhere within the page, although normally
they would be found within geoif tags.
Further information on the supported geobytes tags is available here.
How to add a localized welcome message:
<geoselect>
<geoif geodefault>
<p>Default geo-content -Special Welcome to
visitors from <geobytes city>,<geobytes country>.</p>
</geoif>
</geoselect>
By default the <geoselect> tag will use the IP address of the person
viewing the page, but this can be overridden to allow GeoSelect to use an IP
Address that appears on the page, perhaps contained in a sales report, or site
activity log. You can also have more than one <geoselect> tag per
page, so that a page full of IP Address data can quickly be transformed into usable information.
You do this by inserting the IP Address to
use into the geoselect tag like this <geoselect ip="38.107.191.96">
Showing different content to different
locations:
Let's say that you run an on-line pharmacy and currently service the continental United States. Your business is growing and you have plans to
soon expand into Alaska and Hawaii. Your goal is to reassure people from the continental United States that you do deliver to their area while informing
visitors from Alaska and Hawaii that you will be servicing their area soon.
To
achieve this, you might insert the following code:
-
<!-- US is the location code for the
United States -->
<!-- USAK,USHI are the location codes for Alaska, and Hawaii -->
<geoselect>
<geoif location="US">
<p>We also deliver to great places like
<geobytes city>,
<geobytes country>.</p>
</geoif>
<geoif location="USAK,USHI">
<p>Coming soon to <geobytes city>, <geobytes country>.
Please leave your email address so that we can let you
know when our services are available
in <geobytes region>
</p>
</geoif>
<geoif geodefault>
<p>Sorry but our services are currently unavailable in
<geobytes
country>.</p>
</geoif>
<geoif default>
<p>Please select your location from this list to find out
if our
services are available in your area.</p>
</geoif>
</geoselect>
How to insert Country Flags
The code to do this would look something like this:
<geoselect>
<geoif geodefault>
<p><img border="0" src="Flags/<geobytes
fips104>-flag.jpg"></p>
</geoif>
</geoselect>
By using the fips104 code as a <geobytes> tag the flag of the viewer's country can be quickly inserted. The jpg files for all flags can be obtained from the
CIA World FactBook Site or from
here.
GeoSelect includes a feature that allows you to determine an Internet user’s
location information via client headers. The headers are natively available to
any web application on the server servicing the request, and therefore can be
accessed from any development environment. It is extremely easy to integrate
this into an existing web application, and does not require any components,
third party API’s or interfaces.
There are quite a number of headers that you can use to customize data within
your web application, a list of the available headers is provided here.
Examples Using Geobytes Headers
with ASP
<% City=Request.ServerVariables(“HTTP_GEOBYTESCITY”)
%>
with PERL
$City=$ENV{HTTP_GEOBYTESCITY};
with PHP4
$City=$_SERVER["HTTP_GEOBYTESCITY"];
with PHP3
$City=$HTTP_SERVER_VARS["HTTP_GEOBYTESCITY"];
The GeoSelect "Location Bar" allows you to over-ride the location that GeoSelect uses to process the page. The location bar allows you to view a page as it would be seen from
different locations. It is intended that developers will use it to test and demo their pages - to show what the page would look like when viewed from
different locations.
To add the location bar to a page, you just insert one line of code like this,
<geoselect locationbar="UKENLOND,USNYNYOR,USAKPETE,USHIHONO,RANDOM"
title="Demo other city locations" tab="GEOBYTES"></geoselect>
indicating the locations that should appear on the bar, and GeoSelect does the rest. The code must be inserted within the HTML headers of the page somewhere between <head> and </head>).
When viewing the page, GeoSelect will insert a sliding bar to the left of the screen displaying each of the locations you specified. To view the page from the desired location, just click the location on the bar and the page will reload assuming you are a viewer from the location you clicked on. The location bar also contains a parameter called “random”, if this parameter is specified GeoSelect will then add a random location into the bar. This allows you to check out what your page looks like from a random location in the world.
You can see the Location Bar in action on this page.
Using the sliding bar on the left of the screen you can see how
this page changes depending upon the location you specified.
You can also see this bar in action on the home
page and on the GeoServer page.
Finding the location code for a City, Region or
Country
The last point you need to know to get this running is the location codes for
the cities, regions and countries that you wish to target.
The easiest way is to use our on-line location
string generator, but as you have probably realised now, you can pretty much
guess the code of many of the countries and regions.
For further assistance with using GeoSelect, please see our
EpiCenter or post your question in our forums
site.
How do I get started?
To get started, all you need is a $49 developer license. Once you are
ready to take the site operational in a commercial environment, then you'll find
our server licenses to also be very attractively priced.
More...
| More Information |
|
|
![]() |
|
![]() |
|