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

Function loadRecTag

ads/vendors/a9.js:111–124  ·  view source on GitHub ↗

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

(global, data, publisherUrl)

Source from the content-addressed store, hash-verified

109 * @param {string} publisherUrl
110 */
111function loadRecTag(global, data, publisherUrl) {
112 let url = getURL(data);
113 url += '&adInstanceId=' + data['adinstanceid'];
114 global['amzn_assoc_URL'] = publisherUrl;
115
116 if (data['recomtype'] === 'sync') {
117 writeScript(global, url);
118 } else if (data['recomtype'] === 'async') {
119 const d = global.document.createElement('div');
120 d.setAttribute('id', data['divid']);
121 global.document.getElementById('c').appendChild(d);
122 loadScript(global, url);
123 }
124}
125
126/**
127 * @param {!Window} global

Callers 1

a9Function · 0.85

Calls 5

writeScriptFunction · 0.90
loadScriptFunction · 0.90
getURLFunction · 0.85
setAttributeMethod · 0.45
getElementByIdMethod · 0.45

Tested by

no test coverage detected