I'm using Codehelper.io
Their PHP Class is nice, they can detect real IP for you, and get location , returned JSON with country, city, latidude, calling code, user's languages and more.
They also support Javascript. Check out example at their site.
getRealIP();
$visitor_location = $_ip->getLocation($real_client_ip_address);
// Output result
echo $visitor_location['Country']."";
echo "";
print_r($visitor_location);