-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy path_a4a-config.js
56 lines (52 loc) · 2.02 KB
/
_a4a-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {map} from '#core/types/object';
/**
* Registry for A4A (AMP Ads for AMPHTML pages) "is supported" predicates.
* If an ad network, {@code ${NETWORK}}, is registered in this object, then the
* {@code <amp-ad type="${NETWORK}">} implementation will look up its predicate
* here. If there is a predicate and it and returns {@code true}, then
* {@code amp-ad} will attempt to render the ad via the A4A pathway (fetch
* ad creative via early XHR CORS request; verify that it is validated AMP;
* and then render directly in the host page by splicing into the host DOM).
* Otherwise, it will attempt to render the ad via the existing "3p iframe"
* pathway (delay load into a cross-domain iframe).
*
* @type {!{[key: string]: function(!Window, !Element): boolean}}
*/
let a4aRegistry;
/**
* Returns the a4a registry map
* @return {object}
*/
export function getA4ARegistry() {
if (!a4aRegistry) {
a4aRegistry = map({
'adsense': () => true,
'adzerk': () => true,
'dianomi': () => true,
'doubleclick': () => true,
'fake': () => true,
'mgid': (win, adTag) =>
!adTag.hasAttribute('data-container') &&
!adTag.hasAttribute('data-website'),
'nws': () => true,
'smartadserver': () => true,
'valueimpression': () => true,
// TODO: Add new ad network implementation "is enabled" functions here.
// Note: if you add a function here that requires a new "import", above,
// you'll probably also need to add an exception to
// build-system/test-configs/dep-check-config.js in the
// "filesMatching: 'ads/**/*.js'" rule.
});
}
return a4aRegistry;
}
/**
* An object mapping signing server names to their corresponding URLs.
* @type {!{[key: string]: string}}
*/
export const signingServerURLs = {
/* eslint-disable local/no-forbidden-terms */
'google': 'https://cdn.ampproject.org/amp-ad-verifying-keyset.json',
'google-dev': 'https://cdn.ampproject.org/amp-ad-verifying-keyset-dev.json',
/* eslint-enable local/no-forbidden-terms */
};