• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prebid / Prebid.js / #302

11 Jun 2025 02:18AM UTC coverage: 90.359% (+0.1%) from 90.216%
#302

push

travis-ci

prebidjs-release
Prebid 9.49.1 release

43098 of 54130 branches covered (79.62%)

63790 of 70596 relevant lines covered (90.36%)

175.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/modules/verizonMediaIdSystem.js
1
/**
1✔
2
 * This module adds verizonMediaId to the User ID module
3
 * The {@link module:modules/userId} module is required
4
 * @module modules/verizonMediaIdSystem
5
 * @requires module:modules/userId
6
 */
7

8
import {ajax} from '../src/ajax.js';
9
import {submodule} from '../src/hook.js';
10
import {formatQS, logError} from '../src/utils.js';
11

12
/**
13
 * @typedef {import('../modules/userId/index.js').Submodule} Submodule
14
 * @typedef {import('../modules/userId/index.js').SubmoduleConfig} SubmoduleConfig
15
 * @typedef {import('../modules/userId/index.js').ConsentData} ConsentData
16
 * @typedef {import('../modules/userId/index.js').IdResponse} IdResponse
17
 */
18

19
const MODULE_NAME = 'verizonMediaId';
1✔
20
const VENDOR_ID = 25;
1✔
21
const PLACEHOLDER = '__PIXEL_ID__';
1✔
22
const VMCID_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PLACEHOLDER}/fed`;
1✔
23

24
function isEUConsentRequired(consentData) {
25
  return !!(consentData && consentData.gdpr && consentData.gdpr.gdprApplies);
18✔
26
}
27

28
/** @type {Submodule} */
29
export const verizonMediaIdSubmodule = {
1✔
30
  /**
31
   * used to link submodule with config
32
   * @type {string}
33
   */
34
  name: MODULE_NAME,
35
  /**
36
   * Vendor id of Verizon Media EMEA Limited
37
   * @type {Number}
38
   */
39
  gvlid: VENDOR_ID,
40
  /**
41
   * decode the stored id value for passing to bid requests
42
   * @function
43
   * @returns {{connectid: string} | undefined}
44
   */
45
  decode(value) {
46
    return (typeof value === 'object' && (value.connectid || value.vmuid))
6✔
47
      ? {connectid: value.connectid || value.vmuid} : undefined;
4✔
48
  },
49
  /**
50
   * Gets the Verizon Media Connect ID
51
   * @function
52
   * @param {SubmoduleConfig} [config]
53
   * @param {ConsentData} [consentData]
54
   * @returns {IdResponse|undefined}
55
   */
56
  getId(config, consentData) {
57
    const params = config.params || {};
12!
58
    if (!params || typeof params.he !== 'string' ||
12✔
59
        (typeof params.pixelId === 'undefined' && typeof params.endpoint === 'undefined')) {
60
      logError('The verizonMediaId submodule requires the \'he\' and \'pixelId\' parameters to be defined.');
3✔
61
      return;
3✔
62
    }
63

64
    const data = {
9✔
65
      '1p': [1, '1', true].includes(params['1p']) ? '1' : '0',
9✔
66
      he: params.he,
67
      gdpr: isEUConsentRequired(consentData) ? '1' : '0',
9✔
68
      gdpr_consent: isEUConsentRequired(consentData) ? consentData.gdpr.consentString : '',
9✔
69
      us_privacy: consentData && consentData.usp ? consentData.usp : ''
27!
70
    };
71

72
    if (params.pixelId) {
9✔
73
      data.pixelId = params.pixelId
8✔
74
    }
75

76
    const resp = function (callback) {
9✔
77
      const callbacks = {
9✔
78
        success: response => {
79
          let responseObj;
80
          if (response) {
×
81
            try {
×
82
              responseObj = JSON.parse(response);
×
83
            } catch (error) {
84
              logError(error);
×
85
            }
86
          }
87
          callback(responseObj);
×
88
        },
89
        error: error => {
90
          logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
×
91
          callback();
×
92
        }
93
      };
94
      const endpoint = VMCID_ENDPOINT.replace(PLACEHOLDER, params.pixelId);
9✔
95
      let url = `${params.endpoint || endpoint}?${formatQS(data)}`;
9✔
96
      verizonMediaIdSubmodule.getAjaxFn()(url, callbacks, null, {method: 'GET', withCredentials: true});
9✔
97
    };
98
    return {callback: resp};
9✔
99
  },
100

101
  /**
102
   * Return the function used to perform XHR calls.
103
   * Utilised for each of testing.
104
   * @returns {Function}
105
   */
106
  getAjaxFn() {
107
    return ajax;
×
108
  },
109
  eids: {
110
    'connectid': {
111
      source: 'verizonmedia.com',
112
      atype: 3
113
    },
114
  }
115
};
116

117
submodule('userId', verizonMediaIdSubmodule);
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc