MCPcopy Create free account
hub / github.com/ampproject/amphtml / initMasterFrame

Function initMasterFrame

ads/vendors/pubmine.js:19–46  ·  view source on GitHub ↗

* @param {!Object} data * @param {!Window} global

(data, global)

Source from the content-addressed store, hash-verified

17 * @param {!Window} global
18 */
19function initMasterFrame(data, global) {
20 /*
21 * INSUFFICIENT and UNKNOWN should be treated as INSUFFICIENT
22 * unless state is UNKNOWN and `data-npa-on-unknown-consent=false`
23 */
24 const paUnknown =
25 data['npaOnUnknownConsent'] !== undefined &&
26 'false' == data['npaOnUnknownConsent'];
27 const ctxt = global.context;
28 const consent =
29 ctxt.initialConsentState === null ||
30 ctxt.initialConsentState === CONSENT_POLICY_STATE.SUFFICIENT ||
31 ctxt.initialConsentState === CONSENT_POLICY_STATE.UNKNOWN_NOT_REQUIRED ||
32 (ctxt.initialConsentState === CONSENT_POLICY_STATE.UNKNOWN && paUnknown);
33
34 global['__ATA_PP'] = {
35 pt: data['pt'] || 1,
36 ht: data['ht'] || 1,
37 tn: 'amp',
38 amp: true,
39 consent: consent ? 1 : 0,
40 siteid: Number(data['siteid']) || undefined,
41 blogid: Number(data['blogid']) || undefined,
42 };
43 global['__ATA'] = global['__ATA'] || {};
44 global['__ATA']['cmd'] = global['__ATA']['cmd'] || [];
45 loadScript(global, pubmineURL);
46}
47
48/**
49 * @param {string} slotId

Callers 1

pubmineFunction · 0.85

Calls 1

loadScriptFunction · 0.90

Tested by

no test coverage detected