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

Function googleBlockParameters

ads/google/a4a/utils.js:182–209  ·  view source on GitHub ↗
(a4a, opt_experimentIds)

Source from the content-addressed store, hash-verified

180 * @return {!{[key: string]: null|number|string}} block level parameters
181 */
182export function googleBlockParameters(a4a, opt_experimentIds) {
183 const {element: adElement, win} = a4a;
184 const slotRect = getPageLayoutBoxBlocking(adElement);
185 const iframeDepth = iframeNestingDepth(win);
186 const enclosingContainers = getEnclosingContainerTypes(adElement);
187 if (
188 a4a.uiHandler.isStickyAd() &&
189 !enclosingContainers.includes(ValidAdContainerTypes['AMP-STICKY-AD'])
190 ) {
191 enclosingContainers.push(ValidAdContainerTypes['AMP-STICKY-AD']);
192 }
193 let eids = adElement.getAttribute(EXPERIMENT_ATTRIBUTE);
194 if (opt_experimentIds) {
195 eids = mergeExperimentIds(opt_experimentIds, eids);
196 }
197 const aexp = adElement.getAttribute(AMP_EXPERIMENT_ATTRIBUTE);
198 return {
199 'adf': DomFingerprint.generate(adElement),
200 'nhd': iframeDepth,
201 'eid': eids,
202 'adx': Math.round(slotRect.left),
203 'ady': Math.round(slotRect.top),
204 'oid': '2',
205 'act': enclosingContainers.length ? enclosingContainers.join() : null,
206 // aexp URL param is separated by `!`, not `,`.
207 'aexp': aexp ? aexp.replace(/,/g, '!') : null,
208 };
209}
210
211/**
212 * @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc

Callers 2

getBlockParameters_Method · 0.90
googleAdUrlFunction · 0.85

Calls 9

getPageLayoutBoxBlockingFunction · 0.90
iframeNestingDepthFunction · 0.85
mergeExperimentIdsFunction · 0.85
isStickyAdMethod · 0.80
getAttributeMethod · 0.80
generateMethod · 0.80
pushMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected