File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ export const spec = {
37
37
*/
38
38
buildRequests : function ( validBidRequests , bidderRequest ) {
39
39
const slots = validBidRequests . map ( beOpRequestSlotsMaker ) ;
40
+ const firstPartyData = bidderRequest . ortb2 ;
41
+ const psegs = ( firstPartyData && firstPartyData . user && firstPartyData . user . ext && firstPartyData . user . ext . data ) ? firstPartyData . user . ext . data . permutive : undefined ;
40
42
const pageUrl = getPageUrl ( bidderRequest . refererInfo , window ) ;
41
43
const gdpr = bidderRequest . gdprConsent ;
42
44
const firstSlot = slots [ 0 ] ;
@@ -68,6 +70,10 @@ export const spec = {
68
70
tc_string : ( gdpr && gdpr . gdprApplies ) ? gdpr . consentString : null ,
69
71
} ;
70
72
73
+ if ( psegs ) {
74
+ Object . assign ( payloadObject , { psegs : psegs } ) ;
75
+ }
76
+
71
77
const payloadString = JSON . stringify ( payloadObject ) ;
72
78
return {
73
79
method : 'POST' ,
Original file line number Diff line number Diff line change @@ -130,6 +130,30 @@ describe('BeOp Bid Adapter tests', () => {
130
130
expect ( payload . url ) . to . exist ;
131
131
// check that the protocol is added correctly
132
132
expect ( payload . url ) . to . equal ( 'http://test.te' ) ;
133
+ expect ( payload . psegs ) . to . not . exist ;
134
+ } ) ;
135
+
136
+ it ( 'should call the endpoint with psegs data if any' , function ( ) {
137
+ let bidderRequest =
138
+ {
139
+ 'ortb2' : {
140
+ 'user' : {
141
+ 'ext' : {
142
+ 'data' : {
143
+ 'permutive' : [ 1234 , 5678 , 910 ]
144
+ }
145
+ }
146
+ }
147
+ }
148
+ } ;
149
+
150
+ const request = spec . buildRequests ( bidRequests , bidderRequest ) ;
151
+ const payload = JSON . parse ( request . data ) ;
152
+ expect ( payload . psegs ) . to . exist ;
153
+ expect ( payload . psegs ) . to . include ( 1234 ) ;
154
+ expect ( payload . psegs ) . to . include ( 5678 ) ;
155
+ expect ( payload . psegs ) . to . include ( 910 ) ;
156
+ expect ( payload . psegs ) . to . not . include ( 1 ) ;
133
157
} ) ;
134
158
135
159
it ( 'should not prepend the protocol in page url if already present' , function ( ) {
You can’t perform that action at this time.
0 commit comments