From 5042c2c1a238c56c8fbdb6a451d3f659e3b71733 Mon Sep 17 00:00:00 2001 From: daniel manan Date: Mon, 27 Nov 2023 10:41:11 +0200 Subject: [PATCH 1/3] Collect CPM and cuurency from the winnning bid --- modules/geoedgeRtdProvider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/geoedgeRtdProvider.js b/modules/geoedgeRtdProvider.js index 646d2f4e786..3cdba652ac8 100644 --- a/modules/geoedgeRtdProvider.js +++ b/modules/geoedgeRtdProvider.js @@ -116,7 +116,9 @@ function getMacros(bid, key) { '%_hbadomains': bid.meta && bid.meta.advertiserDomains, '%%PATTERN:hb_pb%%': bid.pbHg, '%%SITE%%': location.hostname, - '%_pimp%': PV_ID + '%_pimp%': PV_ID, + '%_hbCpm!': bid.cpm, + '%_hbCurrency!': bid.currency }; } From 5c0963b36cb5a09de52e21be26261195b73b09ba Mon Sep 17 00:00:00 2001 From: daniel manan Date: Sun, 3 Dec 2023 15:37:05 +0200 Subject: [PATCH 2/3] Export getMacros for test --- modules/geoedgeRtdProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/geoedgeRtdProvider.js b/modules/geoedgeRtdProvider.js index 3cdba652ac8..afaaef93169 100644 --- a/modules/geoedgeRtdProvider.js +++ b/modules/geoedgeRtdProvider.js @@ -103,7 +103,7 @@ export function wrapHtml(wrapper, html) { * @param {string} key * @return {Object} */ -function getMacros(bid, key) { +export function getMacros(bid, key) { return { '${key}': key, '%%ADUNIT%%': bid.adUnitCode, From 395fb79035656444f15d67ff45c219d7522fc2a8 Mon Sep 17 00:00:00 2001 From: daniel manan Date: Sun, 3 Dec 2023 15:37:28 +0200 Subject: [PATCH 3/3] Update tests --- test/spec/modules/geoedgeRtdProvider_spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/spec/modules/geoedgeRtdProvider_spec.js b/test/spec/modules/geoedgeRtdProvider_spec.js index 96da2e3dbd7..b0307a60a3c 100644 --- a/test/spec/modules/geoedgeRtdProvider_spec.js +++ b/test/spec/modules/geoedgeRtdProvider_spec.js @@ -6,6 +6,7 @@ import { getInPageUrl, htmlPlaceholder, setWrapper, + getMacros, wrapper, WRAPPER_URL } from '../../../modules/geoedgeRtdProvider.js'; @@ -117,6 +118,15 @@ describe('Geoedge RTD module', function () { expect(wrapper).to.equal(mockWrapper); }); }); + describe('getMacros', function () { + it('return a dictionary of macros replaced with values from bid object', function () { + let bid = mockBid('testBidder'); + let dict = getMacros(bid, key); + let hasCpm = dict['%_hbCpm!'] === bid.cpm; + let hasCurrency = dict['%_hbCurrency!'] === bid.currency; + expect(hasCpm && hasCurrency); + }); + }); describe('onBidResponseEvent', function () { let bidFromA = mockBid('bidderA'); it('should wrap bid html when bidder is configured', function () {