Skip to content

Commit

Permalink
AdagioAnalyticsAdapter: remove adagio auctionId override
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyfall committed Jul 8, 2024
1 parent ccae637 commit 3fb4533
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
17 changes: 2 additions & 15 deletions modules/adagioAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ const cache = {
...values
};
},

// Map prebid auction id to adagio auction id
auctionIdReferences: {},
addPrebidAuctionIdRef(auctionId, adagioAuctionId) {
this.auctionIdReferences[auctionId] = adagioAuctionId;
},
getAdagioAuctionId(auctionId) {
return this.auctionIdReferences[auctionId];
}
};
const enc = window.encodeURIComponent;

Expand Down Expand Up @@ -250,9 +241,6 @@ function handlerAuctionInit(event) {
// We assume that all Adagio bids for a same adunit have the same params.
const params = adagioAdUnitBids[0].params;

const adagioAuctionId = params.adagioAuctionId;
cache.addPrebidAuctionIdRef(prebidAuctionId, adagioAuctionId);

// Get all media types requested for Adagio.
const adagioMediaTypes = removeDuplicates(
adagioAdUnitBids.map(bid => Object.keys(bid.mediaTypes)).flat(),
Expand All @@ -265,7 +253,7 @@ function handlerAuctionInit(event) {
org_id: params.organizationId,
site: params.site,
pv_id: params.pageviewId,
auct_id: adagioAuctionId,
auct_id: prebidAuctionId,
adu_code: adUnitCode,
url_dmn: w.location.hostname,
pgtyp: params.pagetype,
Expand Down Expand Up @@ -342,9 +330,8 @@ function handlerBidWon(event) {

const adagioAuctionCacheId = (
(event.latestTargetedAuctionId && event.latestTargetedAuctionId !== event.auctionId)
? cache.getAdagioAuctionId(event.auctionId)
? event.auctionId
: null);

cache.updateAuction(auctionId, event.adUnitCode, {
win_bdr: event.bidder,
win_mt: getMediaTypeAlias(event.mediaType),
Expand Down
24 changes: 10 additions & 14 deletions test/spec/modules/adagioAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ describe('adagio analytics adapter - adagio.js', () => {
});

const AUCTION_ID = '25c6d7f5-699a-4bfc-87c9-996f915341fa';
const AUCTION_ID_ADAGIO = '6fc53663-bde5-427b-ab63-baa9ed296f47'
const AUCTION_ID_CACHE = 'b43d24a0-13d4-406d-8176-3181402bafc4';
const AUCTION_ID_CACHE_ADAGIO = 'a9cae98f-efb5-477e-9259-27350044f8db';

const BID_ADAGIO = {
bidder: 'adagio',
Expand Down Expand Up @@ -395,8 +393,7 @@ const AUCTION_INIT_ANOTHER = {
'bids': [ {
'bidder': 'adagio',
'params': {
...PARAMS_ADG,
adagioAuctionId: AUCTION_ID_ADAGIO
...PARAMS_ADG
},
'mediaTypes': {
'banner': {
Expand Down Expand Up @@ -532,8 +529,7 @@ const AUCTION_INIT_CACHE = {
'bids': [ {
'bidder': 'adagio',
'params': {
...PARAMS_ADG,
adagioAuctionId: AUCTION_ID_CACHE_ADAGIO
...PARAMS_ADG
},
'mediaTypes': {
'banner': {
Expand Down Expand Up @@ -676,7 +672,7 @@ describe('adagio analytics adapter', () => {
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('1');
expect(search.pbjsv).to.equal('$prebid.version$');
expect(search.auct_id).to.equal(AUCTION_ID_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.org_id).to.equal('1001');
expect(search.site).to.equal('test-com');
Expand Down Expand Up @@ -708,7 +704,7 @@ describe('adagio analytics adapter', () => {
expect(hostname).to.equal('c.4dex.io');
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('3');
expect(search.auct_id).to.equal(AUCTION_ID_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.win_bdr).to.equal('another');
expect(search.win_mt).to.equal('ban');
Expand Down Expand Up @@ -749,7 +745,7 @@ describe('adagio analytics adapter', () => {
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('1');
expect(search.pbjsv).to.equal('$prebid.version$');
expect(search.auct_id).to.equal(AUCTION_ID_CACHE_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID_CACHE);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.org_id).to.equal('1001');
expect(search.site).to.equal('test-com');
Expand All @@ -772,7 +768,7 @@ describe('adagio analytics adapter', () => {
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('1');
expect(search.pbjsv).to.equal('$prebid.version$');
expect(search.auct_id).to.equal(AUCTION_ID_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.org_id).to.equal('1001');
expect(search.site).to.equal('test-com');
Expand Down Expand Up @@ -804,8 +800,8 @@ describe('adagio analytics adapter', () => {
expect(hostname).to.equal('c.4dex.io');
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('3');
expect(search.auct_id).to.equal(AUCTION_ID_ADAGIO);
expect(search.auct_id_c).to.equal(AUCTION_ID_CACHE_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID);
expect(search.auct_id_c).to.equal(AUCTION_ID_CACHE);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.win_bdr).to.equal('adagio');
expect(search.win_mt).to.equal('ban');
Expand All @@ -821,8 +817,8 @@ describe('adagio analytics adapter', () => {
expect(hostname).to.equal('c.4dex.io');
expect(pathname).to.equal('/pba.gif');
expect(search.v).to.equal('4');
expect(search.auct_id).to.equal(AUCTION_ID_ADAGIO);
expect(search.auct_id_c).to.equal(AUCTION_ID_CACHE_ADAGIO);
expect(search.auct_id).to.equal(AUCTION_ID);
expect(search.auct_id_c).to.equal(AUCTION_ID_CACHE);
expect(search.adu_code).to.equal('/19968336/header-bid-tag-1');
expect(search.rndr).to.equal('0');
}
Expand Down

0 comments on commit 3fb4533

Please sign in to comment.