Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Detect Country and redirect site using Wipmania

I want to redirect users to different sites according to their country. Example: if user visits the site www.abitapp.com and they are from Panama, they should be redirect to www.abitapp.com/pa

I have tried this answer but didn't work: Detect Country And Redirect

<script>
function determineCountry(data){
   switch(data.address.country_code){
      case "IN" :
         document.location.href = "http://xxxxxxxx.biz/theme.php";
      break;
   }    
}
</script>
<script type="text/javascript" src="http://api.wipmania.com/jsonp?callback=determineCountry"></script> 

Find below how I have used it:

<script>
function determineCountry(data){
    switch(data.address.country_code){
      case "PY" :
         document.location.href = "https://www.abitapp.com/py";
      break;
   }    
}
</script>
<script type="text/javascript" src="http://api.wipmania.com/jsonp?callback=determineCountry"></script>

Comments