Personalize by Country
This example shows you how you can customize content on your site depending on the user's location.
// Getting the country name from the user's IP
$.get("https://api.ipdata.co?api-key=<<apiKey>>", function (response) {
if (response.country_code == 'UK') {
alert("Special offer for all our users from " +response.country_name+ "!");
}
}, "jsonp");
This example displays an alert with a special offer targeted at users from the UK.
You can drill down and target users by a more specific location such as;
- Region
- City
- Postal Code
You can also customize your site based on; - The user's timezone
- The user's currency - eg. on your pricing page or shopping catalogs
- The user's language - we recommend getting the user's language from their Browser settings, however as a fallback you could use our language field to determine the user's likely language
Updated about 2 years ago