Skip to content

Commit

Permalink
Feedad Bid Adapter: added new bid request parameters (#9397)
Browse files Browse the repository at this point in the history
* added file scaffold

* added isBidRequestValid implementation

* added local prototype of ad integration

* added implementation for placement ID validation

* fixed video context filter

* applied lint to feedad bid adapter

* added unit test for bid request validation

* added buildRequest unit test

* added unit tests for timeout and bid won callbacks

* updated bid request to FeedAd API

* added parsing of feedad api bid response

* added transmisison of tracking events to FeedAd Api

* code cleanup

* updated feedad unit tests for buildRequest method

* added unit tests for event tracking implementation

* added unit test for interpretResponse method

* added adapter documentation

* added dedicated feedad example page

* updated feedad adapter to use live system

* updated FeedAd adapter placement ID regex

* removed groups from FeedAd adapter placement ID regex

* removed dedicated feedad example page

* updated imports in FeedAd adapter file to use relative paths

* updated FeedAd adapter unit test to use sinon.useFakeXMLHttpRequest()

* added GDPR fields to the FeedAd bid request

* removed video from supported media types of the FeedAd adapter

* increased version code of FeedAd adapter to 1.0.2

* removed unnecessary check of bidder request

* fixed unit test testing for old FeedAd version

* removed video media type example from documentation file

* added gvlid to FeedAd adapter

* added decoration parameter to adapter documentation

* added pass through of additional bid parameters

* added user syncs to FeedAd bid adapter

* increased FeedAd bid adapter version

* lint pass over FeedAd bid adapter

* fixed parsing of user syncs from server response

* increased FeedAd bid adapter version

* fixed version code in test file

* added adapter and prebid version to bid request parameters

* removed TODO item

* added missing test case for user syncs

* increased adapter version to 1.0.5
  • Loading branch information
couchcrew-thomas authored Jan 5, 2023
1 parent 978926d commit 408221b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
12 changes: 7 additions & 5 deletions modules/feedadBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {ajax} from '../src/ajax.js';
* Version of the FeedAd bid adapter
* @type {string}
*/
const VERSION = '1.0.4';
const VERSION = '1.0.5';

/**
* @typedef {object} FeedAdApiBidRequest
Expand All @@ -16,7 +16,8 @@ const VERSION = '1.0.4';
* @property {number} ad_type
* @property {string} client_token
* @property {string} placement_id
* @property {string} sdk_version
* @property {string} prebid_adapter_version
* @property {string} prebid_sdk_version
* @property {boolean} app_hybrid
*
* @property {string} [app_bundle_id]
Expand Down Expand Up @@ -181,7 +182,8 @@ function createApiBidRParams(request) {
ad_type: 0,
client_token: request.params.clientToken,
placement_id: request.params.placementId,
sdk_version: `prebid_${VERSION}`,
prebid_adapter_version: VERSION,
prebid_sdk_version: '$prebid.version$',
app_hybrid: false,
});
}
Expand All @@ -207,7 +209,6 @@ function buildRequests(validBidRequests, bidderRequest) {
})
});
data.bids.forEach(bid => BID_METADATA[bid.bidId] = {
// TODO: is 'page' the right value here?
referer: data.refererInfo.page,
transactionId: bid.transactionId
});
Expand Down Expand Up @@ -266,7 +267,8 @@ function createTrackingParams(data, klass) {
prebid_bid_id: bidId,
prebid_transaction_id: transactionId,
referer,
sdk_version: VERSION
prebid_adapter_version: VERSION,
prebid_sdk_version: '$prebid.version$',
};
}

Expand Down
24 changes: 23 additions & 1 deletion test/spec/modules/feedadBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {BANNER, NATIVE, VIDEO} from '../../../src/mediaTypes.js';
import {server} from 'test/mocks/xhr.js';

const CODE = 'feedad';
const EXPECTED_ADAPTER_VERSION = '1.0.5';

describe('FeedAdAdapter', function () {
describe('Public API', function () {
Expand Down Expand Up @@ -300,6 +301,20 @@ describe('FeedAdAdapter', function () {
expect(result.data.gdprApplies).to.equal(request.gdprConsent.gdprApplies);
expect(result.data.consentIabTcf).to.equal(request.gdprConsent.consentString);
});
it('should include adapter and prebid version', function () {
let bid = {
code: 'feedad',
mediaTypes: {
banner: {
sizes: [[320, 250]]
}
},
params: {clientToken: 'clientToken', placementId: 'placement-id'}
};
let result = spec.buildRequests([bid], bidderRequest);
expect(result.data.bids[0].params.prebid_adapter_version).to.equal(EXPECTED_ADAPTER_VERSION);
expect(result.data.bids[0].params.prebid_sdk_version).to.equal('$prebid.version$');
});
});

describe('interpretResponse', function () {
Expand Down Expand Up @@ -482,6 +497,12 @@ describe('FeedAdAdapter', function () {
expect(() => spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, it)).not.to.throw;
});
});

it('should return empty array if the body extension is null', function () {
const response = mockServerResponse({ext: null});
const result = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, response);
expect(result).to.deep.equal([]);
});
});

describe('event tracking calls', function () {
Expand Down Expand Up @@ -617,7 +638,8 @@ describe('FeedAdAdapter', function () {
prebid_bid_id: bidId,
prebid_transaction_id: transactionId,
referer,
sdk_version: '1.0.4'
prebid_adapter_version: EXPECTED_ADAPTER_VERSION,
prebid_sdk_version: '$prebid.version$',
};
subject(data);
expect(server.requests.length).to.equal(1);
Expand Down

0 comments on commit 408221b

Please sign in to comment.