Skip to content

Commit

Permalink
Axonix bid adapter: set both connectiontype & effectivetype in the re…
Browse files Browse the repository at this point in the history
…quest (prebid#6439)

* Set both connectiontype and effectivetype in the request object

* Version bump

* Fixes for undefined var
  • Loading branch information
César Fernández authored and stsepelin committed May 28, 2021
1 parent 3ce9de8 commit 7579889
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
20 changes: 14 additions & 6 deletions modules/axonixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 => {
Expand All @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions test/spec/modules/axonixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7579889

Please sign in to comment.