@@ -10,6 +10,7 @@ import { getDevice } from '../libraries/fpdUtils/deviceInfo.js';
10
10
import { getBidFloor } from '../libraries/currencyUtils/floor.js' ;
11
11
import { transformSizes , normalAdSize } from '../libraries/sizeUtils/tranformSize.js' ;
12
12
import { getHLen } from '../libraries/navigatorData/navigatorData.js' ;
13
+ import { cookieSync } from '../libraries/cookieSync/cookieSync.js' ;
13
14
14
15
// import { config } from '../src/config.js';
15
16
// import { isPubcidEnabled } from './pubCommonId.js';
@@ -25,7 +26,6 @@ const BIDDER_CODE = 'mediago';
25
26
// const PROTOCOL = window.document.location.protocol;
26
27
const ENDPOINT_URL = 'https://gbid.mediago.io/api/bid?tn=' ;
27
28
// const COOKY_SYNC_URL = 'https://gtrace.mediago.io/ju/cs/eplist';
28
- const COOKY_SYNC_IFRAME_URL = 'https://cdn.mediago.io/js/cookieSync.html' ;
29
29
export const THIRD_PARTY_COOKIE_ORIGIN = 'https://cdn.mediago.io' ;
30
30
31
31
const TIME_TO_LIVE = 500 ;
@@ -39,6 +39,7 @@ let itemMaps = {};
39
39
export const COOKIE_KEY_MGUID = '__mguid_' ;
40
40
const COOKIE_KEY_PMGUID = '__pmguid_' ;
41
41
const COOKIE_RETENTION_TIME = 365 * 24 * 60 * 60 * 1000 ; // 1 year
42
+ const COOKY_SYNC_IFRAME_URL = 'https://cdn.mediago.io/js/cookieSync.html' ;
42
43
let reqTimes = 0 ;
43
44
44
45
/**
@@ -172,6 +173,7 @@ function getItems(validBidRequests, bidderRequest) {
172
173
ortb2Imp : utils . deepAccess ( req , 'ortb2Imp' ) , // 传入完整对象,分析日志数据
173
174
gpid : gpid , // 加入后无法返回广告
174
175
adslot : utils . deepAccess ( req , 'ortb2Imp.ext.data.adserver.adslot' , '' , '' ) ,
176
+ publisher : req . params . publisher || '' ,
175
177
...gdprConsent // gdpr
176
178
} ,
177
179
tagid : req . params && req . params . tagid
@@ -286,9 +288,7 @@ function getParam(validBidRequests, bidderRequest) {
286
288
mobile : isMobile ,
287
289
cat : [ ] , // todo
288
290
publisher : {
289
- // todo
290
- id : domain ,
291
- name : domain
291
+ id : globals [ 'publisher' ]
292
292
}
293
293
} ,
294
294
imp : items ,
@@ -317,6 +317,9 @@ export const spec = {
317
317
if ( bid . params . token ) {
318
318
globals [ 'token' ] = bid . params . token ;
319
319
}
320
+ if ( bid . params . publisher ) {
321
+ globals [ 'publisher' ] = bid . params . publisher ;
322
+ }
320
323
return ! ! bid . params . token ;
321
324
} ,
322
325
@@ -382,42 +385,7 @@ export const spec = {
382
385
} ,
383
386
384
387
getUserSyncs : function ( syncOptions , serverResponse , gdprConsent , uspConsent , gppConsent ) {
385
- const origin = encodeURIComponent ( location . origin || `https://${ location . host } ` ) ;
386
- let syncParamUrl = `dm=${ origin } ` ;
387
-
388
- if ( gdprConsent && gdprConsent . consentString ) {
389
- if ( typeof gdprConsent . gdprApplies === 'boolean' ) {
390
- syncParamUrl += `&gdpr=${ Number ( gdprConsent . gdprApplies ) } &gdpr_consent=${ gdprConsent . consentString } ` ;
391
- } else {
392
- syncParamUrl += `&gdpr=0&gdpr_consent=${ gdprConsent . consentString } ` ;
393
- }
394
- }
395
- if ( uspConsent && uspConsent . consentString ) {
396
- syncParamUrl += `&ccpa_consent=${ uspConsent . consentString } ` ;
397
- }
398
-
399
- if ( syncOptions . iframeEnabled ) {
400
- window . addEventListener ( 'message' , function handler ( event ) {
401
- if ( ! event . data || event . origin != THIRD_PARTY_COOKIE_ORIGIN ) {
402
- return ;
403
- }
404
-
405
- this . removeEventListener ( 'message' , handler ) ;
406
-
407
- event . stopImmediatePropagation ( ) ;
408
-
409
- const response = event . data ;
410
- if ( ! response . optout && response . mguid ) {
411
- storage . setCookie ( COOKIE_KEY_MGUID , response . mguid , getCurrentTimeToUTCString ( ) ) ;
412
- }
413
- } , true ) ;
414
- return [
415
- {
416
- type : 'iframe' ,
417
- url : `${ COOKY_SYNC_IFRAME_URL } ?${ syncParamUrl } `
418
- }
419
- ] ;
420
- }
388
+ return cookieSync ( syncOptions , gdprConsent , uspConsent , BIDDER_CODE , THIRD_PARTY_COOKIE_ORIGIN , COOKY_SYNC_IFRAME_URL , getCurrentTimeToUTCString ( ) ) ;
421
389
} ,
422
390
423
391
/**
0 commit comments