Reply to this topicStart new topic
> Geotargeting tutorial, Through and with code

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 08:30 AM
I just completed a tutorial on geotargeting.

It starts off with what is geotargeting, what it's used for, and then explains how to set up and use geotargeting on your website.

Questions and comments welcome smile.gif

PS - If there is a subject you would like a tutorial on, just ask. I need ideas at the moment thinking.gif
Online Go to the top of the page

Hall of Famer

Group Icon
Group: Hall Of Fame
Joined: 3-November 05
Posts: 3,461
From: CHeeseland
post Dec 27 2005, 10:06 AM
Nice one, Dr. E. !

Do you have a database of country or IP to language codes somewhere? It would be really neat if I could sweep my german speaking visitors to the german version of the site ... and offer my other-speaking visitors a simple link to say Bablefish to translate into their language.

Also, what I would really really love to have is a IP to coordinates (latitude / longitude) conversion. Is Maxmind really the best (=cheapest + high quality data) there is?

Thanks!
John
Offline Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 10:18 AM
QUOTE(softplus @ Dec 27 2005, 03:06 PM)
Nice one, Dr. E. !


Thanks. Glad you like it smile.gif

QUOTE
Do you have a database of country or IP to language codes somewhere? It would be really neat if I could sweep my german speaking visitors to the german version of the site ...  and offer my other-speaking visitors a simple link to say Bablefish to translate into their language.

Oooh. That would be cool. I've never seen one, but it shouldn't be too hard to find or even create. I'll look into it.
QUOTE
Also, what I would really really love to have is a IP to coordinates (latitude / longitude) conversion. Is Maxmind really the best (=cheapest + high quality data) there is?
*



I'm looking into the IP->coordinates thing right now because it is the next tutorial! A mapping feature a la the Digital Point tool, but running locally, and with more features. I've found a few resources, but nothing exactly what we want. Might be a hacking-together job mining the currently available data. I'll keep you posted - watch this space smile.gif

And MaxMind is the only one I could find that gives the data out for free. As for the best, the free version is 97% accurate (or so they claim). It's good enough for most people. They do have 99% accurate databases, but they cost money. Having said that, I've yet to see it detect wrongly...
Online Go to the top of the page

Moderator

Group Icon
Group: Moderators
Joined: 15-January 04
Posts: 4,736
From: Rimouski, Canada
post Dec 27 2005, 01:43 PM
A good, free IP to country database: http://ip-to-country.webhosting.info/
Offline Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 02:39 PM
I think it's the same one as the Maxmind one. You can redistribute the Maxmind database, and my guess is that they are doing the same thing.
Online Go to the top of the page

Star Member

Group: Members
Joined: 18-November 05
Posts: 976
From: Paris - France
post Dec 27 2005, 02:58 PM
Very nice tutorial, don't know if I need geotargeting yet but I will sure use it when needed.
Offline Go to the top of the page

Star Member

Group: Members
Joined: 28-November 05
Posts: 583
From: On the beach, USA
post Dec 27 2005, 05:00 PM
Doctor eKstreme I presume . . .

Great tutorial! Though I haven't, as yet, come up with a specific use for the information, it has got me to thinking about new possibilities, and that's a good thing. smile.gif

Would it be feasible to have a limited, say 1 or 2 lines, for each entry? What I'm thinking about is just maybe showing the national flag and a one, or two line greeting to foreign country visitors in the native language of their country. My traffic lately is running about half and half (US - not US), and I have been wanting to do something to acknowledge that, short of translating the whole site into 90 different languages, of course. blink.gif

My second question, relative to the first, is how would I import the information to an html page? Or would I have to change the site over to php?

I'll be thinking of ideas for other tutorials, and thanks for the ones you've already done.
Offline Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 05:25 PM
Thank you for your comments. Glad you like it!

QUOTE(meriweather @ Dec 27 2005, 10:00 PM)
Would it be feasible to have a limited, say 1 or 2 lines, for each entry? What I'm thinking about is just maybe showing the national flag and a one, or two line greeting to foreign country visitors in the native language of their country. My traffic lately is running about half and half (US - not US), and I have been wanting to do something to acknowledge that, short of translating the whole site into 90 different languages, of course. blink.gif

Your first sentence is killing me... "have a limited" what? smile.gif As for the greeting, you will need the IP/Country->language database softplus and I discussed earlier in the thread. Then on top of that, you'll need the greetings in each language.
QUOTE
My second question, relative to the first, is how would I import the information to an html page? Or would I have to change the site over to php?
*


You could set up your server to parse HTML pages as PHP scripts. It's very easily done using .htaccess. Add the following two lines:
CODE
AddType application/x-httpd-php .html .htm
addhandler application/x-httpd-php .html .php

However, think about the performance issues this will bring up!

And yes, please, I need ideas! I like doing them.
Online Go to the top of the page

Star Member

Group Icon
Group: 1000 Post Club
Joined: 28-April 03
Posts: 1,489
From: UK
post Dec 27 2005, 05:51 PM
Hi, nice article,

The IP database linked to (the csv one) appears to have extra fields in it, terminated by \n not 5 terminated by \r as per article.

Is there another download that I have missed, Im looking ont the linked to page and can only find the one download.

Can always change the csv myself, but easier if its already done wink-2.gif

This post has been edited by kensplace: Dec 27 2005, 06:02 PM
Offline Go to the top of the page

Star Member

Group: Members
Joined: 28-November 05
Posts: 583
From: On the beach, USA
post Dec 27 2005, 06:18 PM
QUOTE
Your first sentence is killing me... "have a limited" what? smile.gif
I hate it when I do that. (get too many things going at once and forget to edit) What I meant to say was, 'have a limited usage of the database.' And whether or not it would be a bigger drain on resources than it would be worth for such a limited use.

QUOTE
Then on top of that, you'll need the greetings in each language.
I understand. Then each greeting would be set up with an "if - then" statement in php, or whatever language it was coded in to match one or more of the locations.

QUOTE
You could set up your server to parse HTML pages as PHP scripts.
Was thinking about a box, or something, on the front page only. That was part of the "limited" question that I didn't quite get out. It would just need to contain the flag and short greeting on the root index page only. Does that make sense, and could it be done? unsure.gif
Offline Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 07:04 PM
Hi.

QUOTE(kensplace @ Dec 27 2005, 10:51 PM)
Hi, nice article,

The IP database linked to  (the csv one) appears to have extra fields in it, terminated by \n not 5 terminated by \r as per article.


You're absolutely right. I set up my database a couple of months ago and it was fine, but now it's not. I think even they got it wrong. See their CSV instructions. They still talk of 4 fields. I emailed them about this and will keep you posted! Thank you for the heads up.

QUOTE
Is there another download that I have missed, Im looking ont the linked to page and can only find the one download.

Can always change the csv myself, but easier if its already done wink-2.gif
*



On the page, the download is under the "CSV Format" heading (direct download link).

And two of my programs (Notepad2 and Crimson Editor) told me that the line endings are \r. I'll look into it in the morning....
Online Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 27 2005, 07:09 PM
meriweather

Well, for something this simple, a faster way would be to check the HTTP_ACCEPT_LANGUAGE header that browsers usually send. It will tell you their preferred language and any other languages they would accept.

Browsers also send language preferences using the user agent string. From my experience, you cannot detect it reliably because each browser sends it in a different format. Opera seems to be the biggest fan of this method.

Once you detect the language, you can have a series of text files, each for a language. Example: en.txt, fr.txt, de.txt, etc etc. Each file would be the greeting in that language. Once you detect the language, see if its file exists; if so, include it. If not, output default greeting.

Softplus, are you reading? This might be what you want!

**hits his head because he didn't think of this solution earlier**
Online Go to the top of the page

Star Member

Group: Members
Joined: 28-November 05
Posts: 583
From: On the beach, USA
post Dec 27 2005, 07:47 PM
eKstreme

I think I get it. If I use a script such as "Full Operating system language detection", by Harald Hope, and set it up so that the results call and write the correct language greeting file to the area set aside on the page, then it should perform the function without the need of a geotargeting database.

Thanks for the tip, am gathering the 'stuff', but will need to get creative with the greetings and the parameters. Sounds like good winter storm work. cool.gif
QUOTE
**hits his head because he didn't think of this solution earlier**
Maybe why I wrote in the first place. I don't really need new projects right now, but something about this intrigued me.
Offline Go to the top of the page

Hall of Famer

Group Icon
Group: Hall Of Fame
Joined: 3-November 05
Posts: 3,461
From: CHeeseland
post Dec 28 2005, 05:18 AM
Of course -- browser language detection smile.gif

A site that does that is http://www.trigeminal.com/ - and in lots of languages! Sadly, his book is no longer available (other than as a used book) and it's not fully transferable to newer technologies (.net, etc) - but if you're interested in internationalisation, you must have that book!
Offline Go to the top of the page

Membership Admin & Moderator

Group Icon
Group: Membership Admin & Moderator
Joined: 30-September 05
Posts: 3,266
From: Some round-ish rock floating in a vacuum.
post Dec 28 2005, 05:39 PM
Right. I've updated the tutorial to fix the discrepancies kensplace found. Thank you again! I hope that fixes it all up. They haven't emailed me back by the way.

Any other questions or comments are most welcome smile.gif

Edit:

For the record, to answer some earlier questions:

1. List of official languages by state. Get the country, get the language smile.gif

2. List of official languages. Get the language, get the country.

3. Languages sorted by country. Mostly for Windows computers, but still a good resource.

This post has been edited by eKstreme: Dec 28 2005, 05:41 PM
Online Go to the top of the page

Hall of Famer

Group Icon
Group: Hall Of Fame
Joined: 3-November 05
Posts: 3,461
From: CHeeseland
post Dec 30 2005, 06:40 PM
Just a quick note of where I'm going to implement this information (as soon as I have the proverbial "some free time"):

Geotargeting affiliate links

I don't have much of that on my sites, I generally just like to play with it to see how it works so that if I should ever go that route, I'll know a bit about it beforehand.

One thing I've noticed - most affiliate sites are targeted for specific areas, countries, language-regions, etc.

What good does it do my site if I show a US-visitor a link to amazon.de ? They won't be able to buy anything because they wouldn't understand a word smile.gif. I'm going to take the country data and associate it with my known affiliate data and let the website automatically server the proper links to the user (perhaps default to US-specific affiliates if unknown). Google Adsense does that, why shouldn't we do it ourselves?

Finally a real international website biggrin.gif

Thanks for the tips, eKstreme! For some things you have to get the right impulse at the right time to make it click in the head, this one took a while for me..

John
Offline Go to the top of the page
Reply to this topic Start new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Jump to Forum:
 
Lo-Fi Version Time is now: 9th February 2010 - 04:27 PM
Meet our Moderators: cre8pc : projectphp : sanity : Black Phoenix : bwelford : EGOL : Ruud : rustybrick : AbleReach : swainzy : joedolson: eKstreme: dazzlindonna : SEOigloo: iamlost : RisaBB
Cre8asite RSS Feed