Skip to content

Commit 603fb25

Browse files
prebidtappxJordi ArnauRuben-Tappx
authored
Tappx Bid Adapter: Fix/os and vendor (#9468)
* 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 --------- Co-authored-by: Jordi Arnau <[email protected]> Co-authored-by: ruben_tappx <[email protected]>
1 parent bb997b2 commit 603fb25

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/tappxBidAdapter.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ function buildOneRequest(validBidRequests, bidderRequest) {
404404
device.w = screen.width;
405405
device.dnt = getDNT() ? 1 : 0;
406406
device.language = getLanguage();
407-
device.make = navigator.vendor ? navigator.vendor : '';
407+
device.make = getVendor();
408408

409409
let geo = {};
410410
geo.country = deepAccess(validBidRequests, 'params.geo.country');
@@ -490,7 +490,12 @@ function getLanguage() {
490490

491491
function getOs() {
492492
let ua = navigator.userAgent;
493-
if (ua == null) { return 'unknown'; } else if (ua.match(/(iPhone|iPod|iPad)/)) { return 'ios'; } else if (ua.match(/Android/)) { return 'android'; } else if (ua.match(/Window/)) { return 'windows'; } else { return 'unknown'; }
493+
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'; }
494+
}
495+
496+
function getVendor() {
497+
let ua = navigator.userAgent;
498+
if (ua.indexOf('Chrome') != -1) { return 'Google'; } else if (ua.indexOf('Firefox') != -1) { return 'Mozilla'; } else if (ua.indexOf('Safari') != -1) { return 'Apple'; } else if (ua.indexOf('Edge') != -1) { return 'Microsoft'; } else if (ua.indexOf('MSIE') != -1 || ua.indexOf('Trident') != -1) { return 'Microsoft'; } else { return ''; }
494499
}
495500

496501
export function _getHostInfo(validBidRequests) {

0 commit comments

Comments
 (0)