Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/teadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const spec = {
const bids = validBidRequests.map(buildRequestObject);
const payload = {
referrer: getReferrerInfo(bidderRequest),
pageReferrer: document.referrer,
networkBandwidth: getConnectionDownLink(window.navigator),
data: bids,
deviceWidth: screen.width,
hb_version: '$prebid.version$'
Expand Down Expand Up @@ -117,6 +119,10 @@ function getReferrerInfo(bidderRequest) {
return ref;
}

function getConnectionDownLink(nav) {
return nav && nav.connection && nav.connection.downlink >= 0 ? nav.connection.downlink.toString() : '';
}

function findGdprStatus(gdprApplies, gdprData, apiVersion) {
let status = gdprStatus.GDPR_APPLIES_PUBLISHER
if (gdprApplies) {
Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/teadsBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,24 @@ describe('teadsBidAdapter', () => {
expect(payload.referrer).to.deep.equal('https://example.com/page.html')
});

it('should add networkBandwidth info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderResquestDefault);
const payload = JSON.parse(request.data);

const bandwidth = window.navigator && window.navigator.connection && window.navigator.connection.downlink;

expect(payload.networkBandwidth).to.exist;
expect(payload.networkBandwidth).to.deep.equal(bandwidth.toString());
});

it('should add pageReferrer info to payload', function () {
const request = spec.buildRequests(bidRequests, bidderResquestDefault);
const payload = JSON.parse(request.data);

expect(payload.pageReferrer).to.exist;
expect(payload.pageReferrer).to.deep.equal(document.referrer);
});

it('should send GDPR to endpoint with 11 status', function() {
let consentString = 'JRJ8RKfDeBNsERRDCSAAZ+A==';
let bidderRequest = {
Expand Down