Skip to content

Commit

Permalink
Tappx Bid Adapter: accept ortb2 country (prebid#9907)
Browse files Browse the repository at this point in the history
* Fix: creating host correctly when http or https are added from the beginning

* Fix :: Changed double quotes for single quotes

* Fix :: Getting the full page URL

* Fix :: Changed order params

* Fix :: Replaced quotes from double to simple

* Fix :: Adapting format to lint

* Remove TODO comment

* Added more controls

* camelcase fix

* Changed test

* Remove "inIframe" util

* Fix: solved error getOs and created getVendor functions

* Fix: Solved CircelCI format problems

* 10207_include setConfig function and intruccions in readme file

* Update tappxBidAdapter.md

* Update tappxBidAdapter.js

* Fix: repriorising to get the OS correctly

* Fix: Correcting EsLint requirements for merge

* Update tappxBidAdapter.js

please add unit tests

---------

Co-authored-by: Jordi Arnau <[email protected]>
Co-authored-by: ruben_tappx <[email protected]>
Co-authored-by: jgarciaorad <[email protected]>
Co-authored-by: Patrick McCann <[email protected]>
  • Loading branch information
5 people authored and Santiago Carabone committed Aug 22, 2023
1 parent 27bda58 commit e513d26
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/tappxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ function buildOneRequest(validBidRequests, bidderRequest) {
const BIDEXTRA = deepAccess(validBidRequests, 'params.ext');
const bannerMediaType = deepAccess(validBidRequests, 'mediaTypes.banner');
const videoMediaType = deepAccess(validBidRequests, 'mediaTypes.video');
const ORTB2 = deepAccess(validBidRequests, 'ortb2');

// let requests = [];
let payload = {};
Expand Down Expand Up @@ -410,6 +411,14 @@ function buildOneRequest(validBidRequests, bidderRequest) {
let geo = {};
geo.country = deepAccess(validBidRequests, 'params.geo.country');
// < Device object
let configGeo = {};
configGeo.country = ORTB2?.device?.geo;

if (typeof configGeo.country !== 'undefined') {
device.geo = configGeo;
} else if (typeof geo.country !== 'undefined') {
device.geo = geo;
};

// > GDPR
let user = {};
Expand Down Expand Up @@ -491,7 +500,7 @@ function getLanguage() {

function getOs() {
let ua = navigator.userAgent;
if (ua.indexOf('Windows') != -1) { return 'Windows'; } else if (ua.indexOf('Mac OS X') != -1) { return 'macOS'; } else if (ua.match(/Android/)) { return 'Android'; } else if (ua.match(/(iPhone|iPod|iPad)/)) { return 'iOS'; } else if (ua.indexOf('Linux') != -1) { return 'Linux'; } else { return 'Unknown'; }
if (ua.match(/Android/)) { return 'Android'; } else if (ua.match(/(iPhone|iPod|iPad)/)) { return 'iOS'; } else if (ua.indexOf('Mac OS X') != -1) { return 'macOS'; } else if (ua.indexOf('Windows') != -1) { return 'Windows'; } else if (ua.indexOf('Linux') != -1) { return 'Linux'; } else { return 'Unknown'; }
}

function getVendor() {
Expand Down
17 changes: 17 additions & 0 deletions modules/tappxBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,20 @@ Ads sizes available: [300,250], [320,50], [320,480], [480,320], [728,90], [768,1
}
];
```
### Configuration

Use `setConfig` to configure this submodule ortb2.device.geo, this will allow geolocation
`Geo` object to bring First Party Information.

```javascript
var TIMEOUT = 1000;
pbjs.setConfig({
ortb2:{
device:{
geo:{
country:'US'
}
}
}
});
```

0 comments on commit e513d26

Please sign in to comment.