Radar is the location platform for mobile apps.
In an HTML page, include the SDK using a
In a web app, install the package from npm, then import the module:
npm install --save radar-sdk-js
The SDK is less than 10 KB minified.
To initialize the SDK, call:
publishableKey is a string containing your Radar publishable API key.
To get a Radar publishable API key, sign up for a Radar account.
If you are using Places, you must set Facebook as your place data provider.
To set Facebook as your place data provider, call:
To disable Places later, call:
Learn more about Places.
Until you identify the user, Radar will automatically identify the user by a random UUID "device ID" stored in a cookie.
To identify the user when logged in, call:
userId is a stable unique ID string for the user.
To set an optional description for the user, displayed in the dashboard, call:
description is a string.
You only need to call these functions once, as these settings will be persisted across browser sessions in cookies.
Once you have initialized the SDK, you have identified the user, and the user has granted permissions, you can track the user's location.
The SDK uses the HTML5 geolocation API to determine the user's location.
To track the user's location, call:
status will be a string, one of:
Radar.STATUS.SUCCESS: the request succeeded
Radar.STATUS.ERROR_PUBLISHABLE_KEY: the SDK was not initialized
Radar.STATUS.ERROR_PERMISSIONS: the user has not granted location permissions for the website
Radar.STATUS.ERROR_LOCATION: location services were unavailable, or the location request timed out
Radar.STATUS.ERROR_NETWORK: the network was unavailable, or the network connection timed out
Radar.STATUS.ERROR_UNAUTHORIZED: the publishable API key is invalid
Radar.STATUS.ERROR_RATE_LIMIT: exceeded rate limit of 1 request per second per user or 60 requests per hour per user
Radar.STATUS.ERROR_SERVER: an internal server error occurred
Have questions? We're here to help! Email us at firstname.lastname@example.org.