File tree 2 files changed +56
-0
lines changed
2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,10 @@ export const spec = {
454
454
setUIDSafe ( response . am ) ;
455
455
}
456
456
457
+ const bidderSettings = config . getConfig ( 'bidderSettings' ) ;
458
+ const settings = bidderSettings ?. amx ?? bidderSettings ?. standard ?? { } ;
459
+ const allowAlternateBidderCodes = ! ! settings . allowAlternateBidderCodes ;
460
+
457
461
return flatMap ( Object . keys ( response . r ) , ( bidID ) => {
458
462
return flatMap ( response . r [ bidID ] , ( siteBid ) =>
459
463
siteBid . b . map ( ( bid ) => {
@@ -466,8 +470,10 @@ export const spec = {
466
470
467
471
const size = resolveSize ( bid , request . data , bidID ) ;
468
472
const defaultExpiration = mediaType === BANNER ? 240 : 300 ;
473
+ const { bc : bidderCode , ds : demandSource } = bid . ext ?? { } ;
469
474
470
475
return {
476
+ ...( bidderCode != null && allowAlternateBidderCodes ? { bidderCode } : { } ) ,
471
477
requestId : bidID ,
472
478
cpm : bid . price ,
473
479
width : size [ 0 ] ,
@@ -479,6 +485,7 @@ export const spec = {
479
485
meta : {
480
486
advertiserDomains : bid . adomain ,
481
487
mediaType,
488
+ ...( demandSource != null ? { demandSource } : { } ) ,
482
489
} ,
483
490
mediaType,
484
491
ttl : typeof bid . exp === 'number' ? bid . exp : defaultExpiration ,
Original file line number Diff line number Diff line change @@ -583,6 +583,55 @@ describe('AmxBidAdapter', () => {
583
583
expect ( parsed ) . to . eql ( [ ] ) ;
584
584
} ) ;
585
585
586
+ it ( 'will read an bidderCode override from bid.ext.prebid.meta' , ( ) => {
587
+ const currentConfig = config . getConfig ( ) ;
588
+ config . setConfig ( {
589
+ ...currentConfig ,
590
+ bidderSettings : {
591
+ amx : {
592
+ allowAlternateBidderCodes : true
593
+ }
594
+ }
595
+ } ) ;
596
+
597
+ const parsed = spec . interpretResponse (
598
+ { body : {
599
+ ...sampleServerResponse ,
600
+ r : {
601
+ [ sampleRequestId ] : [ {
602
+ ...sampleServerResponse . r [ sampleRequestId ] [ 0 ] ,
603
+ b : [ {
604
+ ...sampleServerResponse . r [ sampleRequestId ] [ 0 ] . b [ 0 ] ,
605
+ ext : {
606
+ bc : 'amx-pmp' ,
607
+ ds : 'example' ,
608
+ }
609
+ } ]
610
+ } ]
611
+ } } } ,
612
+ baseRequest
613
+ ) ;
614
+
615
+ config . setConfig ( currentConfig ) ;
616
+ expect ( parsed . length ) . to . equal ( 1 ) ; // we removed one
617
+
618
+ // we should have display, video, display
619
+ expect ( parsed [ 0 ] ) . to . deep . equal ( {
620
+ ...baseBidResponse ,
621
+ meta : {
622
+ ...baseBidResponse . meta ,
623
+ mediaType : BANNER ,
624
+ demandSource : 'example'
625
+ } ,
626
+ mediaType : BANNER ,
627
+ bidderCode : 'amx-pmp' ,
628
+ width : 300 ,
629
+ height : 600 , // from the bid itself
630
+ ttl : 90 ,
631
+ ad : sampleDisplayAd ,
632
+ } ) ;
633
+ } ) ;
634
+
586
635
it ( 'can parse a display ad' , ( ) => {
587
636
const parsed = spec . interpretResponse (
588
637
{ body : sampleServerResponse } ,
You can’t perform that action at this time.
0 commit comments