Hi Allm
we would like to implement personalization on web pages based on geolocalization (latitude and longitude)
We can NOT use the coordinates used by Adobe, because they are based on IP Address.
We are obtaining the coordinates using the following javascript code in the page:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(my_position);
}else{
alert(Something goeas wrong');
}
function my_position (position) {
window.lat = position.coords.latitude;
window.lon = position.coords.longitude;
}
For example:
The variable window.lat will be set with the value: 45.44910443697823
The variable window.lon will be set with the value: 9.125338282382
If I print in the same page the Adobe variable (you can see they are different)
- profile.geolocation.latitude is set with the value 51.2347
- profile.geolocation.longitude is set with the value 6.71389
This happens because adobe define the latitude and longitude starting from the IP while the browser is using the right position of the user.
What I want to do is to OVERRIDE profile.geolocation.latitude and profile.geolocation.longitude with the right value we have from the browser
I tried to create a profile script like this
- profile.geolocation.longitude = window.lon;
- profile.geolocation.latitude = window.lat;
But of course it doesn’t work.
I'm trying to pass this value to the target global mbox using the following javascript code
targetPageParams = function() {
return {
"profile": {
"latitudine": window.lat,
"longitudine": window.lon
}
};
}
but it seems it doesn't work. Can you please help?
Thank you
Best Regards