Skip to content

Commit

Permalink
Mediasquare bidder: remove old user sync method (#7780)
Browse files Browse the repository at this point in the history
* remove old userSyncs method

* Update mediasquareBidAdapter.js

* Update mediasquareBidAdapter.js

* Update mediasquareBidAdapter_spec.js
  • Loading branch information
matthieularere-msq authored Nov 30, 2021
1 parent 37fcad3 commit d481238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 1 addition & 9 deletions modules/mediasquareBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const BIDDER_CODE = 'mediasquare';
const BIDDER_URL_PROD = 'https://pbs-front.mediasquare.fr/'
const BIDDER_URL_TEST = 'https://bidder-test.mediasquare.fr/'
const BIDDER_ENDPOINT_AUCTION = 'msq_prebid';
const BIDDER_ENDPOINT_SYNC = 'cookie_sync';
const BIDDER_ENDPOINT_WINNING = 'winning';

export const spec = {
Expand Down Expand Up @@ -132,18 +131,11 @@ export const spec = {
* @return {UserSync[]} The user syncs which should be dropped.
*/
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
let params = '';
let endpoint = document.location.search.match(/msq_test=true/) ? BIDDER_URL_TEST : BIDDER_URL_PROD;
if (typeof serverResponses === 'object' && serverResponses != null && serverResponses.length > 0 && serverResponses[0].hasOwnProperty('body') &&
serverResponses[0].body.hasOwnProperty('cookies') && typeof serverResponses[0].body.cookies === 'object') {
return serverResponses[0].body.cookies;
} else {
if (gdprConsent && typeof gdprConsent.consentString === 'string') { params += typeof gdprConsent.gdprApplies === 'boolean' ? `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}` : `&gdpr_consent=${gdprConsent.consentString}`; }
if (uspConsent && typeof uspConsent === 'string') { params += '&uspConsent=' + uspConsent }
return {
type: 'iframe',
url: endpoint + BIDDER_ENDPOINT_SYNC + '?type=iframe' + params
};
return [];
}
},

Expand Down
8 changes: 4 additions & 4 deletions test/spec/modules/mediasquareBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('MediaSquare bid adapter tests', function () {
});
it('Verifies user sync without cookie in bid response', function () {
var syncs = spec.getUserSyncs({}, [BID_RESPONSE], DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);
expect(syncs).to.have.property('type').and.to.equal('iframe');
expect(syncs).to.have.lengthOf(0);
});
it('Verifies user sync with cookies in bid response', function () {
BID_RESPONSE.body.cookies = [{'type': 'image', 'url': 'http://www.cookie.sync.org/'}];
Expand All @@ -178,13 +178,13 @@ describe('MediaSquare bid adapter tests', function () {
});
it('Verifies user sync with no bid response', function() {
var syncs = spec.getUserSyncs({}, null, DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);
expect(syncs).to.have.property('type').and.to.equal('iframe');
expect(syncs).to.have.lengthOf(0);
});
it('Verifies user sync with no bid body response', function() {
var syncs = spec.getUserSyncs({}, [], DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);
expect(syncs).to.have.property('type').and.to.equal('iframe');
expect(syncs).to.have.lengthOf(0);
var syncs = spec.getUserSyncs({}, [{}], DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);
expect(syncs).to.have.property('type').and.to.equal('iframe');
expect(syncs).to.have.lengthOf(0);
});
it('Verifies native in bid response', function () {
const request = spec.buildRequests(NATIVE_PARAMS, DEFAULT_OPTIONS);
Expand Down

0 comments on commit d481238

Please sign in to comment.