hi
asp.net 3.5
I wonder if there are some simple way of geotargeting the content ofa
website. I ask cause I want to place CPA ads on my website, some CPA
campaigns are only visible to users of a certain country. So I thought
of make a check of which country the visiting user comes from and then
load the correct CPA offer for that country.
I know about ip2location where you can check against for free. but
wonder if there are some other ways I implement this, maybe
geocloaking - haven't done it before as it's a bit blackhat.
any suggestions?
The end game is this. I have an IP. It is registered to some group,
which is located in some country. Essentially, I go back to a registry
to find out where it is registered. One choice is registries like ARIN,
APNIC and RIPE. Years ago, I created an app that culled information from
these sites (screen scrape) for a company that did not want to purchase
this information. Today, you have services like ip2location, etc, which
offer the same type of service, so you don't have to do a lot of
programming to get your information.
The only issue I have with things like ip2location comes when you need
immediate feedback. Any public service can go down or experience some
network latency. You need a backup methodology, just in case. But there
are others out there you can use (just Google). I am sure there are also
databases you can buy, but I am not sure they are cost effective for
serving worldwide CPA ads. Just my two cents on this matter.
One backup, which can also be flawed, is examining culture. I would not
choose language over culture, as EN-US and EN-UK are different regions.
Same with ES-SP, ES-MX, etc. I realize you can delve down, but Culture
is what the .NET framework looks at, and since it takes no additional
lines of code to use culture over language ...
As stated above, the culture is set at the thread level and ties backto
language, but it is easier to work for customization, as there is
already a great deal of globalization/localization code in .NET. Michele
Leroux Bustamante has some great articles on the MSDN site on
globalization/localization, if you need to get a theoretical background
with some practical advice. She also maintains her own site, which has
additional info.
The point is you are getting into design. Think through the optimal path
(sounds like you have) and then start looking for roadblocks, potholes,
etc and create mitigation plans. You will never hit 100% accurate, but
you can do fairly well for 99.9% of the people (or greater).
--
Peace and Grace,
Greg
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
************************************************
| Think outside the box! |
************************************************
As of now I use this code to determine country. I know it's not perfect,
but maybe it will be 99% accurate.
It's some code I came across when googling, maybe I remove the extra if
for "tr"
public static CultureInfo GetCulture()
{
HttpRequest Request = HttpContext.Current.Request;
if (Request.UserLanguages == null)
return null;
string lang = Request.UserLanguages[0];
if (lang != null)
{
// *** Problems with Turkish Locale and upper/lower case
// *** DataRow/DataTable indexes
if (lang.StartsWith("tr"))
return null;
try
{
return new CultureInfo(lang);
}
catch
{
return null;
}
}
else
return null;
}
then in my code I check against cultureinfo.Name:
eksample : culture.Name == 'no' for Norway