city($clientip); $country = $record->country->name; $region = $record->mostSpecificSubdivision->name; $city = $record->city->name; $countrycode = $record->country->isoCode; $regioncode = $record->mostSpecificSubdivision->isoCode; $lat = $record->location->latitude; $lon = $record->location->longitude; // // Save the page visit // $database->insert("analytics", [ "siteid" => getsiteid(), "pageid" => getpageid(), "uuid" => $uuid, "country" => $country, "region" => $region, "city" => $city, "countrycode" => $countrycode, "regioncode" => $regioncode, "lat" => $lat, "lon" => $lon, "time" => $time ]); } catch (GeoIp2\Exception\AddressNotFoundException $e) { if (DEBUG) { echo ""; } } catch (Exception $e) { // Silently fail so the rest of the site still works }