@@ -9,6 +9,7 @@ import * as utils from '../src/utils.js';
9
9
import { submodule } from '../src/hook.js' ;
10
10
import { getStorageManager } from '../src/storageManager.js' ;
11
11
import { ajax } from '../src/ajax.js' ;
12
+ import { uspDataHandler , coppaDataHandler } from '../src/adapterManager.js' ;
12
13
13
14
const PUB_COMMON_ID = 'PublisherCommonId' ;
14
15
const MODULE_NAME = 'pubCommonId' ;
@@ -142,9 +143,18 @@ function handleResponse(pubcid, callback, config) {
142
143
* @return {string }
143
144
*/
144
145
function sharedIdUrl ( consentData ) {
145
- if ( ! consentData || typeof consentData . gdprApplies !== 'boolean' || ! consentData . gdprApplies ) return SHAREDID_URL ;
146
-
147
- return `${ SHAREDID_URL } ?gdpr=1&gdpr_consent=${ consentData . consentString } `
146
+ const usPrivacyString = uspDataHandler . getConsentData ( ) ;
147
+ let sharedIdUrl = SHAREDID_URL ;
148
+ if ( usPrivacyString && typeof usPrivacyString === 'string' ) {
149
+ sharedIdUrl = `${ SHAREDID_URL } ?us_privacy=${ usPrivacyString } ` ;
150
+ }
151
+ if ( ! consentData || typeof consentData . gdprApplies !== 'boolean' || ! consentData . gdprApplies ) return sharedIdUrl ;
152
+ if ( usPrivacyString ) {
153
+ sharedIdUrl = `${ sharedIdUrl } &gdpr=1&gdpr_consent=${ consentData . consentString } `
154
+ return sharedIdUrl ;
155
+ }
156
+ sharedIdUrl = `${ SHAREDID_URL } ?gdpr=1&gdpr_consent=${ consentData . consentString } ` ;
157
+ return sharedIdUrl
148
158
}
149
159
150
160
/**
@@ -223,6 +233,11 @@ export const pubCommonIdSubmodule = {
223
233
* @returns {IdResponse }
224
234
*/
225
235
getId : function ( config = { } , consentData , storedId ) {
236
+ const coppa = coppaDataHandler . getCoppa ( ) ;
237
+ if ( coppa ) {
238
+ utils . logInfo ( 'PubCommonId: IDs not provided for coppa requests, exiting PubCommonId' ) ;
239
+ return ;
240
+ }
226
241
const { params : { create = true , pixelUrl, enableSharedId = SHAREDID_DEFAULT_STATE } = { } } = config ;
227
242
let newId = storedId ;
228
243
if ( ! newId ) {
@@ -263,6 +278,11 @@ export const pubCommonIdSubmodule = {
263
278
* @returns {IdResponse|undefined }
264
279
*/
265
280
extendId : function ( config = { } , consentData , storedId ) {
281
+ const coppa = coppaDataHandler . getCoppa ( ) ;
282
+ if ( coppa ) {
283
+ utils . logInfo ( 'PubCommonId: IDs not provided for coppa requests, exiting PubCommonId' ) ;
284
+ return ;
285
+ }
266
286
const { params : { extend = false , pixelUrl, enableSharedId = SHAREDID_DEFAULT_STATE } = { } } = config ;
267
287
268
288
if ( extend ) {
0 commit comments