From 22dcb1e6992e5099b705dc7894d4a31acf7a02f5 Mon Sep 17 00:00:00 2001 From: AdmixerTech Date: Tue, 30 May 2023 15:38:03 +0300 Subject: [PATCH 1/3] add geolocation rtd provider --- dev-docs/modules/geolocationRtdProvider.md | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 dev-docs/modules/geolocationRtdProvider.md diff --git a/dev-docs/modules/geolocationRtdProvider.md b/dev-docs/modules/geolocationRtdProvider.md new file mode 100644 index 0000000000..9683fbd798 --- /dev/null +++ b/dev-docs/modules/geolocationRtdProvider.md @@ -0,0 +1,74 @@ +--- +layout: page_v2 +title: Geolocation Module +display_name: Geolocation +description: Real Time Geolocation +page_type: module +module_type: rtd +module_code : geolocationRtdProvider +enable_download : true +sidebarType : 1 +--- + +# Geolocation Module +{:.no_toc} + +* TOC +{:toc} + +## Overview + +The Geolocation module provides Geolocation coords using +[Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API). + +Implementation works like this: + + 1) Build the Geolocation module into the Prebid.js package with: + +``` +gulp build --modules=geolocationRtdProvider&... +``` + +2) Use `setConfig` to instruct the browser to obtain the geolocation data + +## Configuration + +This module is configured as part of the `realTimeData.dataProviders` object: + +``` + pbjs.setConfig({ + "realTimeData": { + auctionDelay: 100, + dataProviders:[{ + "name": "geolocation", + "waitForIt": true, + "requestPermission": true + }] + } + }); +``` +#### Params +| Name | Type | Example | Description | +|:------------------:|:---------:|:---------:|---------------------------------------| +| requestPermission | Boolean | true | Request Geo permission if not granted | + +## Output + +For each bidder, the module adds geolocation in a JSON format. +Example: +``` +{ + "geolocation":{ + 'boundingClientRect': { + 'accuracy': 1, + 'altitude': 10, + 'altitudeAccuracy': 1, + 'heading': 1, + 'latitude': 1, + 'longitude': 10, + 'speed': 10, + }, + } +} +``` + From c290e2ca2cfdd8bca80417025dcaff7101d1367a Mon Sep 17 00:00:00 2001 From: AdmixerTech Date: Tue, 6 Jun 2023 13:24:01 +0300 Subject: [PATCH 2/3] move requestPermission to params --- dev-docs/modules/geolocationRtdProvider.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev-docs/modules/geolocationRtdProvider.md b/dev-docs/modules/geolocationRtdProvider.md index 9683fbd798..c2dce61aad 100644 --- a/dev-docs/modules/geolocationRtdProvider.md +++ b/dev-docs/modules/geolocationRtdProvider.md @@ -42,7 +42,9 @@ This module is configured as part of the `realTimeData.dataProviders` object: dataProviders:[{ "name": "geolocation", "waitForIt": true, - "requestPermission": true + "params": { + "requestPermission": true + } }] } }); From 2b5df216233272b5eb22367d277ebf1f16a9705f Mon Sep 17 00:00:00 2001 From: AdmixerTech Date: Tue, 6 Jun 2023 13:45:02 +0300 Subject: [PATCH 3/3] update output to ortb2 --- dev-docs/modules/geolocationRtdProvider.md | 39 +++++++++++----------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/dev-docs/modules/geolocationRtdProvider.md b/dev-docs/modules/geolocationRtdProvider.md index c2dce61aad..f945928fa1 100644 --- a/dev-docs/modules/geolocationRtdProvider.md +++ b/dev-docs/modules/geolocationRtdProvider.md @@ -5,16 +5,17 @@ display_name: Geolocation description: Real Time Geolocation page_type: module module_type: rtd -module_code : geolocationRtdProvider -enable_download : true -sidebarType : 1 +module_code: geolocationRtdProvider +enable_download: true +sidebarType: 1 --- # Geolocation Module + {:.no_toc} * TOC -{:toc} + {:toc} ## Overview @@ -23,7 +24,7 @@ The Geolocation module provides Geolocation coords using Implementation works like this: - 1) Build the Geolocation module into the Prebid.js package with: +1) Build the Geolocation module into the Prebid.js package with: ``` gulp build --modules=geolocationRtdProvider&... @@ -49,27 +50,27 @@ This module is configured as part of the `realTimeData.dataProviders` object: } }); ``` + #### Params -| Name | Type | Example | Description | -|:------------------:|:---------:|:---------:|---------------------------------------| -| requestPermission | Boolean | true | Request Geo permission if not granted | + +| Name | Type | Example | Description | +|:-----------------:|:-------:|:-------:|---------------------------------------| +| requestPermission | Boolean | true | Request Geo permission if not granted | ## Output -For each bidder, the module adds geolocation in a JSON format. +Module adds data to the `ortb2.device.geo` in a JSON format. Example: + ``` { - "geolocation":{ - 'boundingClientRect': { - 'accuracy': 1, - 'altitude': 10, - 'altitudeAccuracy': 1, - 'heading': 1, - 'latitude': 1, - 'longitude': 10, - 'speed': 10, - }, + "device": { + "geo":{ + 'lat': 1, + 'lon': 10, + 'lastfix': 1993399, + 'type': 1 + } } } ```