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

AMX RTB: remove use of auctionId #10052

Merged
merged 1 commit into from
Jun 22, 2023
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
23 changes: 11 additions & 12 deletions modules/amxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import {
_each,
deepAccess,
Expand All @@ -10,15 +10,16 @@ import {
logError,
parseUrl,
triggerPixel,
generateUUID,
} from '../src/utils.js';
import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';
import { config } from '../src/config.js';
import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'amx';
const storage = getStorageManager({ bidderCode: BIDDER_CODE });
const SIMPLE_TLD_TEST = /\.com?\.\w{2,4}$/;
const DEFAULT_ENDPOINT = 'https://prebid.a-mo.net/a/c';
const VERSION = 'pba1.3.2';
const VERSION = 'pba1.3.3';
const VAST_RXP = /^\s*<\??(?:vast|xml)/i;
const TRACKING_ENDPOINT = 'https://1x1.a-mo.net/hbx/';
const AMUID_KEY = '__amuidpb';
Expand Down Expand Up @@ -255,12 +256,12 @@ function getGpp(bidderRequest) {
return bidderRequest.gppConsent;
}

return bidderRequest?.ortb2?.regs?.gpp ?? {gppString: '', applicableSections: ''};
return bidderRequest?.ortb2?.regs?.gpp ?? { gppString: '', applicableSections: '' };
}

function buildReferrerInfo(bidderRequest) {
if (bidderRequest.refererInfo == null) {
return {r: '', t: false, c: '', l: 0, s: []}
return { r: '', t: false, c: '', l: 0, s: [] }
}

const re = bidderRequest.refererInfo;
Expand Down Expand Up @@ -303,8 +304,7 @@ export const spec = {
};

const payload = {
// TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
a: bidderRequest.auctionId,
a: generateUUID(),
B: 0,
b: loc.host,
brc: fbid.bidderRequestsCount || 0,
Expand Down Expand Up @@ -388,9 +388,9 @@ export const spec = {
const output = [];
let hasFrame = false;

_each(serverResponses, function ({ body: response }) {
_each(serverResponses, function({ body: response }) {
if (response != null && response.p != null && response.p.hreq) {
_each(response.p.hreq, function (syncPixel) {
_each(response.p.hreq, function(syncPixel) {
const pixelType =
syncPixel.indexOf('__st=iframe') !== -1 ? 'iframe' : 'image';
if (syncOptions.iframeEnabled || pixelType === 'image') {
Expand Down Expand Up @@ -483,7 +483,6 @@ export const spec = {
bid: timeoutData.bidId,
a: timeoutData.adUnitCode,
cn: timeoutData.timeout,
aud: timeoutData.auctionId,
});
},

Expand Down
9 changes: 6 additions & 3 deletions test/spec/modules/amxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const sampleBidderRequest = {
gppString: 'example',
applicableSections: 'example'
},
auctionId: utils.getUniqueIdentifierStr(),

auctionId: null,

uspConsent: '1YYY',
refererInfo: {
reachedTop: true,
Expand Down Expand Up @@ -90,7 +92,8 @@ const sampleBidRequestBase = {
adUnitCode: 'div-gpt-ad-example',
transactionId: utils.getUniqueIdentifierStr(),
bidId: sampleRequestId,
auctionId: utils.getUniqueIdentifierStr(),

auctionId: null,
};

const schainConfig = {
Expand Down Expand Up @@ -494,7 +497,7 @@ describe('AmxBidAdapter', () => {

it('can build a video request', () => {
const { data } = spec.buildRequests(
[{...sampleBidRequestVideo, params: { ...sampleBidRequestVideo.params, adUnitId: 'custom-auid' }}],
[{ ...sampleBidRequestVideo, params: { ...sampleBidRequestVideo.params, adUnitId: 'custom-auid' } }],
sampleBidderRequest
);
expect(Object.keys(data.m).length).to.equal(1);
Expand Down