The Geolocation module lets publishers get user’s precise location with their permissions. The first permission that is needed is directly asked from site’s navigator alert. Then if site has installed a CMP (Consent Management Platform), this module checks the geolocation permission from consent data. The module provides Geolocation coords using the Geolocation API.
Build the geolocation RTD module into the Prebid.js package with:
gulp build --modules=geolocationRtdProvider.js,...
Use setConfig
to instruct Prebid.js to initilize the geolocation module, as specified below.
This module is configured as part of the realTimeData.dataProviders
object:
pbjs.setConfig({
realTimeData: {
dataProviders: [{
"name": "geolocation",
"waitForIt": true,
"params": {
"requestPermission": true
}
}]
}
});
Parameter details:
Name | Type | Description | Notes |
---|---|---|---|
name | String | Real time data module name | Required, always ‘geolocation’ |
waitForIt | Boolean | Required, always true | |
params | Object | ||
params.requestPermission | Boolean | Customer permission | Required, always true |
The Geolocation is set in ortb2Fragments.global.device.geo in requestBidsObject and looks like this:
{
lat: 1, // geolocation.coords.latitude
lon: 1, // geolocation.coords.longitude
lastfix: 1, // geolocation.timestamp
type: 1
}
This data can be accessed from a bid adapter in one of several ways: