From 7579889d1d1b225af27dcb0c8f2b1516b8f26eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Fern=C3=A1ndez?= Date: Fri, 19 Mar 2021 15:35:45 +0100 Subject: [PATCH] Axonix bid adapter: set both connectiontype & effectivetype in the request (#6439) * Set both connectiontype and effectivetype in the request object * Version bump * Fixes for undefined var --- modules/axonixBidAdapter.js | 20 ++++++++++++++------ test/spec/modules/axonixBidAdapter_spec.js | 6 ++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/axonixBidAdapter.js b/modules/axonixBidAdapter.js index 161ea8c6715f..224486467f3f 100644 --- a/modules/axonixBidAdapter.js +++ b/modules/axonixBidAdapter.js @@ -5,7 +5,7 @@ import * as utils from '../src/utils.js'; import { ajax } from '../src/ajax.js'; const BIDDER_CODE = 'axonix'; -const BIDDER_VERSION = '1.0.0'; +const BIDDER_VERSION = '1.0.1'; const CURRENCY = 'USD'; const DEFAULT_REGION = 'us-east-1'; @@ -81,11 +81,18 @@ export const spec = { buildRequests: function(validBidRequests, bidderRequest) { // device.connectiontype - let connection = navigator.connection || navigator.webkitConnection; - let connectiontype = 'unknown'; + let connection = window.navigator && (window.navigator.connection || window.navigator.mozConnection || window.navigator.webkitConnection) + let connectionType = 'unknown'; + let effectiveType = ''; - if (connection && connection.effectiveType) { - connectiontype = connection.effectiveType; + if (connection) { + if (connection.type) { + connectionType = connection.type; + } + + if (connection.effectiveType) { + effectiveType = connection.effectiveType; + } } const requests = validBidRequests.map(validBidRequest => { @@ -105,7 +112,8 @@ export const spec = { app, site, validBidRequest, - connectiontype, + connectionType, + effectiveType, devicetype: isMobile() ? 1 : isConnectedTV() ? 3 : 2, bidfloor: getBidFloor(validBidRequest), dnt: (navigator.doNotTrack === 'yes' || navigator.doNotTrack === '1' || navigator.msDoNotTrack === '1') ? 1 : 0, diff --git a/test/spec/modules/axonixBidAdapter_spec.js b/test/spec/modules/axonixBidAdapter_spec.js index 632e080f83d4..aac1cbe08ff0 100644 --- a/test/spec/modules/axonixBidAdapter_spec.js +++ b/test/spec/modules/axonixBidAdapter_spec.js @@ -179,7 +179,8 @@ describe('AxonixBidAdapter', function () { expect(data.site).to.have.property('page', 'https://www.prebid.org'); expect(data).to.have.property('validBidRequest', BANNER_REQUEST); - expect(data).to.have.property('connectiontype').to.exist; + expect(data).to.have.property('connectionType').to.exist; + expect(data).to.have.property('effectiveType').to.exist; expect(data).to.have.property('devicetype', 2); expect(data).to.have.property('bidfloor', 0); expect(data).to.have.property('dnt', 0); @@ -237,7 +238,8 @@ describe('AxonixBidAdapter', function () { expect(data.site).to.have.property('page', 'https://www.prebid.org'); expect(data).to.have.property('validBidRequest', VIDEO_REQUEST); - expect(data).to.have.property('connectiontype').to.exist; + expect(data).to.have.property('connectionType').to.exist; + expect(data).to.have.property('effectiveType').to.exist; expect(data).to.have.property('devicetype', 2); expect(data).to.have.property('bidfloor', 0); expect(data).to.have.property('dnt', 0);