Redirects page base on user country

Hi guys, I’m struggling to find a good resource on how to execute this. I wanted to redirect the page base on user location. I know this required custom code but at the moment I’m stuck with it and most of the resources that I found are outdated. I’m using ipinfo.io to determine the user country.

Here’s the code that I’m using :

$.get(“https://ipinfo.io”, function(data) {
if(data.country !== “GB”){
console.log(“no gb”)
}else {
var test
test = ‘GB’
console.log(“THIS IS GB”)}
}, “jsonp”);

But then I’m stuck on how to use those value and redirect the page.

If anyone have any experience on this please guide me :pray:t3:

@samliew sorry for calling you here, but do you have any advice on this ?

You already have the basic structure for conditions, so now all you gotta do is tell what page the user should go according to each location. Ex:

window.location.replace(“http://www.yourwebsote.com/gb-users”);

Redirects with JS
Conditionals

@syamsul.rozmey Do you have a working solution for this problem?