Home >
Programming, Servers & Scripts >
Geo location on CDN hosted Lander? (7)
02-25-2015 08:51 PM
#1
maximillion (Member)
Geo location on CDN hosted Lander?
Hey I was wondering if it was possible to display specific images or text based on a visitor's location on a lander that's entirely hosted on a CDN?
02-26-2015 12:03 AM
#2
deedsmedia (Member)
You can use JavaScript for it. Append the users location to the URL and grab the query string:
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var prodId = getParameterByName('prodId');
And then use JS to choose what you want to display.
if (prodId == 'test') {
// change image
} else if (prodId == 'notest') {
// change image
}
02-26-2015 02:38 AM
#3
maximillion (Member)
Thanks, deeds. I'll try that, I thought it wasn't possibly with static files only.
02-26-2015 10:28 AM
#4
caurmen (Administrator)
It's completely possible, but you need a way to get the visitor's location to your lander - like passing it from your tracker or from the traffic source.
(Well, technically that's not true - you could call a third-party server using Javascript to get the visitor's location, or use HTML5 Location techniques - but getting the location from the tracker or traffic source is about a million times easier
)
02-27-2015 04:09 AM
#5
maximillion (Member)

Originally Posted by
caurmen
(Well, technically that's not true - you could call a third-party server using Javascript to get the visitor's location)
That's what I did. Works great.
07-02-2015 05:22 PM
#6
aushustler87 (AMC Alumnus)
Awesome thread, managed to get this working on my CDN and im not much of a techie 
Just a follow up question to this, say if im targetting a non English speaking country, or even a country with a non-latin based set of letters (Thailand, Russia, Egypt, etc), is there anyway to get the variable called out in the local language?
I'm not sure if a Russian or Japanese person could understand or recognise "Apple Iphone 6" in English, or whether they'd need a translation to understand it.
Hope this makes sense, thanks.
04-18-2016 08:32 PM
#7
felyxx (Member)

Originally Posted by
aushustler87
Awesome thread, managed to get this working on my CDN and im not much of a techie
Just a follow up question to this, say if im targetting a non English speaking country, or even a country with a non-latin based set of letters (Thailand, Russia, Egypt, etc), is there anyway to get the variable called out in the local language?
I'm not sure if a Russian or Japanese person could understand or recognise "Apple Iphone 6" in English, or whether they'd need a translation to understand it.
Hope this makes sense, thanks.
For Russia it's probably better to keep the name in English. At least for "Apple iPhone 6".
But each case can be individual. For example, I would spell Tesla in Russian - Тесла.
It depends on the brand name.
Home >
Programming, Servers & Scripts >