Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Adding useBaseGvlid to aliasBidAdapter #12247

Merged
merged 2 commits into from
Sep 19, 2024
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: 4 additions & 2 deletions src/adapterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,13 @@ adapterManager.aliasBidAdapter = function (bidderCode, alias, options) {
newAdapter = new bidAdapter.constructor();
newAdapter.setBidderCode(alias);
} else {
const { useBaseGvlid = false } = options || {};
let spec = bidAdapter.getSpec();
let gvlid = options && options.gvlid;
if (spec.gvlid != null && gvlid == null) {
const gvlid = useBaseGvlid ? spec.gvlid : options?.gvlid;
if (gvlid == null && spec.gvlid != null) {
logWarn(`Alias '${alias}' will NOT re-use the GVL ID of the original adapter ('${spec.code}', gvlid: ${spec.gvlid}). Functionality that requires TCF consent may not work as expected.`)
}

let skipPbsAliasing = options && options.skipPbsAliasing;
newAdapter = newBidder(Object.assign({}, spec, { code: alias, gvlid, skipPbsAliasing }));
_aliasRegistry[alias] = bidderCode;
Expand Down
9 changes: 9 additions & 0 deletions test/spec/unit/core/adapterManager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,15 @@ describe('adapterManager tests', function () {
expect(adapterManager.videoAdapters).to.include(alias);
}
});

it('should use gvlid of original adapter when option set', () => {
const gvlid = 'origvlid';
let thisSpec = Object.assign(spec, { gvlid });
registerBidder(thisSpec);
const alias = 'bidderWithGvlid';
adapterManager.aliasBidAdapter(CODE, alias, {useBaseGvlid: true});
expect(adapterManager.bidderRegistry[alias].getSpec()?.gvlid).to.deep.eql(gvlid);
})
});

describe('special case for s2s-only bidders', function () {
Expand Down