Geo plugin provided geolocation data of user's browser using services provided by http://www.geoplugin.net/
npm install geoplugin- Get geolocation of visitor's browser
- Get geolocation by IP
- Supports the Promise API
- Automatic transforms for JSON data
- Free geolocation data provided by http://www.geoplugin.net/
!Chrome | !Firefox | !Safari | !Opera | !Edge | !IE |
--- | --- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
https protocol. To subscribe geoPlugin premium services please refer to their website Premium IP geolocation accessUsing npm:
``bash`
$ npm install geoplugin
Using yarn:
`bash`
$ yarn add geoplugin
`js`
import {getGeo, getGeoByIp} from 'geoplugin';
Getting geolocation of user's browser.
`js
import {getGeo} from 'geoplugin';
// Get geolocation of a user's browser.
getGeo()
.then(response => console.log(response)) // handle success
.catch(error => console.log(error)) // handle error
.then(() => { }); // always executed
`
Getting geolocation by an ip address.
`js
import {getGeoByIp} from 'geoplugin';
// Get geolocation by an ip address.
getGeoByIp('xx.xx.xx.xx')
.then(response => console.log(response)) // handle success
.catch(error => console.log(error)) // handle error
.then(() => { }); // always executed
`
`js`
import {getGeoSSL, getGeoByIpSSL} from 'geoplugin';
Getting geolocation of user's browser.
`js
import {getGeoSSL} from 'geoplugin';
// Get geolocation of a user's browser using premium service.
getGeoSSL('licenseKey')
.then(response => console.log(response)) // handle success
.catch(error => console.log(error)) // handle error
.then(() => { }); // always executed
`
Getting geolocation by an ip address.
`js
import {getGeoByIpSSL} from 'geoplugin';
// Get geolocation by an ip address using premium service.
getGeoByIpSSL('licenseKey','xx.xx.xx.xx')
.then(response => console.log(response)) // handle success
.catch(error => console.log(error)) // handle error
.then(() => { }); // always executed
`
`javascript``
{
request: '11.222.333.44',
status: 200,
delay: '2ms',
areaCode: '',
city: 'Manhattan',
continentCode: 'NA',
continentName: 'North America',
countryCode: 'US',
countryName: 'United States',
credit: "Some of the returned data includes GeoLite data created by MaxMind, available from http://www.maxmind.com.",
currencyCode: 'USD',
currencyConverter: 1,
currencySymbol: '$',
currencySymbol_UTF8: '$',
dmaCode: '501',
euVATRate: false,
inEU: 0,
locationAccuracyRadius: '1',
latitude: '12.345',
longitude: '-67.890',
region: 'New York',
regionCode: 'NY',
regionName: 'New York',
timezone: 'America/New_York'
}
geoplugin depends on a native ES6 Promise implementation to be supported.
If your environment doesn't support ES6 Promises, you can polyfill.
geoplugin is a simple wrapper for REST API provided by geoplugin.com. geoPlugin provides a free geolocation API in multiple different programming languages in a single API call. There is no software installation required, no API key and whether your programming language of choice be Javascript, PHP, XML, JSON, ASP, or CSV, geoPlugin has a way to simply and efficiently geo-localize your visitors.
This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com