Skip to content

Commit

Permalink
Adman Bid Adapter: update getUserSyncs() (prebid#7884)
Browse files Browse the repository at this point in the history
* Add Adman bid adapter

* Add supportedMediaTypes property

* Update ADman Media bidder adapter

* Remove console.log

* Fix typo

* revert package-json.lock

* Delete package-lock.json

* back to original package-lock.json

* catch pbjs error

* catch pbjs error

* catch pbjs error

* log

* remove eu url

* remove eu url

* remove eu url

* remove eu url

* remove eu url

* Update admanBidAdapter.js

add consnet to sync url

* Update admanBidAdapter.js

fix import

* Update admanBidAdapter.js

lint fix

* Update admanBidAdapter.js

lint fix

* Update admanBidAdapter.js

check consent object data availability

* сompatible with prebid v5

* add Lotame Panorama ID

* update getUserSyncs

* fix

* fix tests

* remove package-lock.json

Co-authored-by: minoru katogi <mkatogi@gmail.com>
Co-authored-by: minoru katogi <m_katogi@hotmail.com>
Co-authored-by: ADman Media <admanmedia@users.noreply.github.com>
Co-authored-by: SmartyAdman <adman@localhost.localdomain>
  • Loading branch information
5 people authored and Chris Pabst committed Jan 10, 2022
1 parent 39dbb9a commit a1746ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions modules/admanBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import { isFn, deepAccess, logMessage } from '../src/utils.js';
import {config} from '../src/config.js';

const BIDDER_CODE = 'adman';
const AD_URL = 'https://pub.admanmedia.com/?c=o&m=multi';
const URL_SYNC = 'https://pub.admanmedia.com/?c=o&m=sync';
const URL_SYNC = 'https://pub.admanmedia.com';

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId ||
Expand Down Expand Up @@ -152,19 +153,24 @@ export const spec = {
},

getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent) => {
let syncUrl = URL_SYNC
let syncType = syncOptions.iframeEnabled ? 'iframe' : 'image';
let syncUrl = URL_SYNC + `/${syncType}?pbjs=1`;
if (gdprConsent && gdprConsent.consentString) {
if (typeof gdprConsent.gdprApplies === 'boolean') {
syncUrl += `&gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`;
} else {
syncUrl += `&gdpr==0&gdpr_consent=${gdprConsent.consentString}`;
syncUrl += `&gdpr=0&gdpr_consent=${gdprConsent.consentString}`;
}
}
if (uspConsent && uspConsent.consentString) {
syncUrl += `&ccpa_consent=${uspConsent.consentString}`;
}

const coppa = config.getConfig('coppa') ? 1 : 0;
syncUrl += `&coppa=${coppa}`;

return [{
type: 'image',
type: syncType,
url: syncUrl
}];
}
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/admanBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ describe('AdmanAdapter', function () {
});

describe('getUserSyncs', function () {
let userSync = spec.getUserSyncs();
let userSync = spec.getUserSyncs({});
it('Returns valid URL and type', function () {
expect(userSync).to.be.an('array').with.lengthOf(1);
expect(userSync[0].type).to.exist;
expect(userSync[0].url).to.exist;
expect(userSync[0].type).to.be.equal('image');
expect(userSync[0].url).to.be.equal('https://pub.admanmedia.com/?c=o&m=sync');
expect(userSync[0].url).to.be.equal('https://pub.admanmedia.com/image?pbjs=1&coppa=0');
});
});
});

0 comments on commit a1746ad

Please sign in to comment.