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

geoedge rtd module: support site override #12213

Merged
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
9 changes: 6 additions & 3 deletions modules/geoedgeRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export let wrapper
let wrapperReady;
/** @type {boolean} */;
let preloaded;
/** @type {object} */;
let refererInfo = getRefererInfo();
/** @type {object} */;
let overrides = window.grumi?.overrides;

/**
* fetches the creative wrapper
Expand All @@ -75,9 +79,8 @@ export function setWrapper(responseText) {
}

export function getInitialParams(key) {
let refererInfo = getRefererInfo();
let params = {
wver: 'pbjs',
wver: '1.1.1',
wtype: 'pbjs-module',
key,
meta: {
Expand Down Expand Up @@ -141,7 +144,7 @@ export function getMacros(bid, key) {
'%_hbcid!': bid.creativeId || '',
'%_hbadomains': bid.meta && bid.meta.advertiserDomains,
'%%PATTERN:hb_pb%%': bid.pbHg,
'%%SITE%%': location.hostname,
'%%SITE%%': overrides?.site || refererInfo.domain,
'%_pimp%': PV_ID,
'%_hbCpm!': bid.cpm,
'%_hbCurrency!': bid.currency
Expand Down
8 changes: 8 additions & 0 deletions test/spec/modules/geoedgeRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ describe('Geoedge RTD module', function () {
const hasCurrency = dict['%_hbCurrency!'] === bid.currency;
expect(hasCpm && hasCurrency);
});
it('return a dictionary of macros replaced with values from overrides object if provided', function () {
const bid = mockBid('testBidder');
window.grumi.overrides = { site: 'test-overrides' };
const overrides = window.grumi.overrides;
const dict = getMacros(bid, key);
const siteOveridden = dict['%%SITE%%'] === overrides.site;
expect(siteOveridden);
});
});
describe('onBidResponseEvent', function () {
const bidFromA = mockBid('bidderA');
Expand Down