@highfivve/ad-tag 5.8.17 → 5.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ads/labelConfigService.js +14 -1
- package/lib/ads/modules/ad-reload/index.js +146 -142
- package/lib/ads/modules/adex/index.js +106 -104
- package/lib/ads/modules/cleanup/index.js +64 -61
- package/lib/ads/modules/confiant/index.js +29 -29
- package/lib/ads/modules/emetriq/index.js +107 -102
- package/lib/ads/modules/generic-skin/index.js +128 -127
- package/lib/ads/modules/identitylink/index.js +37 -36
- package/lib/ads/modules/moli-analytics/eventTracker.js +43 -0
- package/lib/ads/modules/moli-analytics/events/gptSlotRenderEnded.js +21 -0
- package/lib/ads/modules/moli-analytics/events/index.js +16 -0
- package/lib/ads/modules/moli-analytics/events/pageView.js +31 -0
- package/lib/ads/modules/moli-analytics/events/prebidAuctionEnd.js +39 -0
- package/lib/ads/modules/moli-analytics/events/prebidBidWon.js +23 -0
- package/lib/ads/modules/moli-analytics/index.js +161 -0
- package/lib/ads/modules/moli-analytics/session.js +60 -0
- package/lib/ads/modules/moli-analytics/types.js +1 -0
- package/lib/ads/modules/prebid-first-party-data/index.js +41 -43
- package/lib/ads/modules/pubstack/abTest.js +11 -0
- package/lib/ads/modules/pubstack/index.js +30 -28
- package/lib/ads/modules/sticky-footer-ad/index.js +25 -25
- package/lib/ads/modules/sticky-footer-ad-v2/index.js +25 -25
- package/lib/ads/modules/sticky-header-ad/index.js +44 -42
- package/lib/ads/modules/zeotap/index.js +93 -93
- package/lib/ads/moli.js +35 -22
- package/lib/bundle/adReload.js +2 -2
- package/lib/bundle/adex.js +2 -2
- package/lib/bundle/cleanup.js +2 -2
- package/lib/bundle/confiant.js +2 -2
- package/lib/bundle/emetriq.js +2 -2
- package/lib/bundle/identityLink.js +2 -2
- package/lib/bundle/moliAnalytics.js +2 -0
- package/lib/bundle/prebidFirstPartyData.js +2 -2
- package/lib/bundle/pubstack.js +2 -2
- package/lib/bundle/skin.js +2 -2
- package/lib/bundle/stickyFooterAd.js +2 -2
- package/lib/bundle/stickyFooterAds2.js +2 -2
- package/lib/bundle/stickyHeaderAd.js +2 -2
- package/lib/bundle/zeotap.js +2 -2
- package/lib/gen/packageJson.js +1 -1
- package/lib/types/prebidjs.js +1 -0
- package/lib/util/browserStorageKeys.js +1 -0
- package/package.json +1 -1
|
@@ -1,57 +1,49 @@
|
|
|
1
1
|
import { intersectionObserverFadeOutCallback } from './fadeOutCallback';
|
|
2
2
|
import { adRenderResult } from './renderResult';
|
|
3
3
|
import { LOW_PRIORITY, mkConfigureStepOncePerRequestAdsCycle, mkPrepareRequestAdsStep } from 'ad-tag/ads/adPipeline';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.observer = null;
|
|
13
|
-
this.stickyHeaderAdConfig = null;
|
|
14
|
-
}
|
|
15
|
-
configure__(moduleConfig) {
|
|
4
|
+
export const createStickyHeaderAd = () => {
|
|
5
|
+
const name = 'sticky-header-ads';
|
|
6
|
+
const containerSelector = '[data-ref="header-ad"]';
|
|
7
|
+
const buttonSelector = '[data-ref="header-ad-close-button"]';
|
|
8
|
+
const navbarHiddenClassName = 'h5v-header-ad--navbarHidden';
|
|
9
|
+
let observer = null;
|
|
10
|
+
let stickyHeaderAdConfig = null;
|
|
11
|
+
const configure__ = (moduleConfig) => {
|
|
16
12
|
if (moduleConfig?.stickyHeaderAd?.enabled) {
|
|
17
|
-
|
|
13
|
+
stickyHeaderAdConfig = moduleConfig.stickyHeaderAd;
|
|
18
14
|
}
|
|
19
|
-
}
|
|
20
|
-
config__()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
configureSteps__() {
|
|
27
|
-
const config = this.stickyHeaderAdConfig;
|
|
15
|
+
};
|
|
16
|
+
const config__ = () => stickyHeaderAdConfig;
|
|
17
|
+
const initSteps__ = () => [];
|
|
18
|
+
const configureSteps__ = () => {
|
|
19
|
+
const config = stickyHeaderAdConfig;
|
|
28
20
|
return config
|
|
29
21
|
? [
|
|
30
22
|
mkConfigureStepOncePerRequestAdsCycle('sticky-header-ads:cleanup', () => {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
if (observer) {
|
|
24
|
+
observer.disconnect();
|
|
25
|
+
observer = null;
|
|
34
26
|
}
|
|
35
27
|
return Promise.resolve();
|
|
36
28
|
})
|
|
37
29
|
]
|
|
38
30
|
: [];
|
|
39
|
-
}
|
|
40
|
-
prepareRequestAdsSteps__() {
|
|
41
|
-
const config =
|
|
31
|
+
};
|
|
32
|
+
const prepareRequestAdsSteps__ = () => {
|
|
33
|
+
const config = stickyHeaderAdConfig;
|
|
42
34
|
return config
|
|
43
35
|
? [
|
|
44
|
-
mkPrepareRequestAdsStep(
|
|
45
|
-
if (
|
|
36
|
+
mkPrepareRequestAdsStep(name, LOW_PRIORITY, (ctx, slots) => {
|
|
37
|
+
if (observer) {
|
|
46
38
|
return Promise.resolve();
|
|
47
39
|
}
|
|
48
40
|
const headerSlot = slots.find(slot => slot.moliSlot.domId === config.headerAdDomId);
|
|
49
41
|
if (!headerSlot) {
|
|
50
42
|
return Promise.resolve();
|
|
51
43
|
}
|
|
52
|
-
const container = ctx.window__.document.querySelector(
|
|
44
|
+
const container = ctx.window__.document.querySelector(containerSelector);
|
|
53
45
|
if (!container) {
|
|
54
|
-
ctx.logger__.warn(
|
|
46
|
+
ctx.logger__.warn(name, `Could not find sticky header container with selector '${containerSelector}'`);
|
|
55
47
|
return Promise.resolve();
|
|
56
48
|
}
|
|
57
49
|
const minVisibleDuration = config.minVisibleDurationMs ?? 0;
|
|
@@ -62,28 +54,28 @@ export class StickyHeaderAd {
|
|
|
62
54
|
const targets = ctx.window__.document.querySelectorAll(config.fadeOutTrigger.selector);
|
|
63
55
|
const target = targets.length > 0 ? targets.item(0) : null;
|
|
64
56
|
const navbarConfig = config.navbarConfig;
|
|
65
|
-
const navbarHiddenClass = navbarConfig?.navbarHiddenClassName ??
|
|
57
|
+
const navbarHiddenClass = navbarConfig?.navbarHiddenClassName ?? navbarHiddenClassName;
|
|
66
58
|
const navbar = navbarConfig
|
|
67
59
|
? ctx.window__.document.querySelector(navbarConfig.selector)
|
|
68
60
|
: null;
|
|
69
61
|
if (target) {
|
|
70
62
|
const adRenderResultPromise = adRenderResult(ctx, headerSlot.moliSlot, config.disallowedAdvertiserIds, minVisibleDuration);
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
observer = new IntersectionObserver(intersectionObserverFadeOutCallback(container, target, adRenderResultPromise, navbar, navbarHiddenClass, config.fadeOutClassName), options);
|
|
64
|
+
observer.observe(target);
|
|
73
65
|
if (navbar) {
|
|
74
|
-
|
|
66
|
+
observer.observe(navbar);
|
|
75
67
|
}
|
|
76
68
|
}
|
|
77
69
|
else {
|
|
78
|
-
ctx.logger__.error(
|
|
70
|
+
ctx.logger__.error(name, `No DOM element found for selector ${config.fadeOutTrigger.selector}. Sticky header may never fade out`);
|
|
79
71
|
}
|
|
80
72
|
}
|
|
81
|
-
const closeButton = ctx.window__.document.querySelector(
|
|
73
|
+
const closeButton = ctx.window__.document.querySelector(buttonSelector);
|
|
82
74
|
if (closeButton) {
|
|
83
75
|
closeButton.addEventListener('click', () => {
|
|
84
76
|
container.classList.add(config.fadeOutClassName);
|
|
85
|
-
if (
|
|
86
|
-
|
|
77
|
+
if (observer) {
|
|
78
|
+
observer.disconnect();
|
|
87
79
|
}
|
|
88
80
|
if (ctx.env__ === 'production') {
|
|
89
81
|
ctx.window__.googletag.destroySlots([headerSlot.adSlot]);
|
|
@@ -99,5 +91,15 @@ export class StickyHeaderAd {
|
|
|
99
91
|
})
|
|
100
92
|
]
|
|
101
93
|
: [];
|
|
102
|
-
}
|
|
103
|
-
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
name,
|
|
97
|
+
description: 'sticky header ad creatives',
|
|
98
|
+
moduleType: 'creatives',
|
|
99
|
+
config__,
|
|
100
|
+
configure__,
|
|
101
|
+
initSteps__,
|
|
102
|
+
configureSteps__,
|
|
103
|
+
prepareRequestAdsSteps__
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -1,111 +1,111 @@
|
|
|
1
1
|
import { mkConfigureStepOncePerRequestAdsCycle, mkInitStep } from 'ad-tag/ads/adPipeline';
|
|
2
2
|
import { AssetLoadMethod } from 'ad-tag/util/assetLoaderService';
|
|
3
3
|
import { tcfapi } from 'ad-tag/types/tcfapi';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.zeotapConfig = null;
|
|
12
|
-
this.hasConsent = (tcData) => {
|
|
13
|
-
if (tcData.gdprApplies) {
|
|
14
|
-
return (tcData.vendor.consents[this.gvlid] &&
|
|
15
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.STORE_INFORMATION_ON_DEVICE] &&
|
|
16
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.CREATE_PERSONALISED_ADS_PROFILE] &&
|
|
17
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.SELECT_PERSONALISED_ADS] &&
|
|
18
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.CREATE_PERSONALISED_CONTENT_PROFILE] &&
|
|
19
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.SELECT_PERSONALISED_CONTENT] &&
|
|
20
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.MEASURE_AD_PERFORMANCE] &&
|
|
21
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.APPLY_MARKET_RESEARCH] &&
|
|
22
|
-
tcData.purpose.consents[tcfapi.responses.TCPurpose.DEVELOP_IMPROVE_PRODUCTS]);
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
};
|
|
26
|
-
this.loadScript = (config, assetLoaderService, moduleConfig) => {
|
|
27
|
-
const { mode, dataKeyValues, exclusionKeyValues, assetUrl, hashedEmailAddress, countryCode } = moduleConfig;
|
|
28
|
-
if (!assetLoaderService) {
|
|
29
|
-
return Promise.reject('Zeotap module :: no asset loader found, module not initialized yet?');
|
|
30
|
-
}
|
|
31
|
-
if (mode === 'default' && this.loadScriptCount > 0) {
|
|
32
|
-
return Promise.reject("Zeotap module :: can't reload script in default mode.");
|
|
33
|
-
}
|
|
34
|
-
const keyValuesMap = this.makeKeyValuesMap(config.targeting?.keyValues);
|
|
35
|
-
if (exclusionKeyValues.some(kv => this.isExclusionKeyValueSet(kv, keyValuesMap))) {
|
|
36
|
-
return Promise.reject('Zeotap module :: targeting exclusions prevented loading the script.');
|
|
37
|
-
}
|
|
38
|
-
const customData = dataKeyValues
|
|
39
|
-
.map(kv => this.parameterFromKeyValue(kv, keyValuesMap))
|
|
40
|
-
.join('&');
|
|
41
|
-
const loadIdPlus = !!moduleConfig.hashedEmailAddress && this.loadScriptCount === 0;
|
|
42
|
-
const url = assetUrl +
|
|
43
|
-
`&idp=${loadIdPlus ? 1 : 0}` +
|
|
44
|
-
(customData.length > 0 ? `&${customData}` : '') +
|
|
45
|
-
(countryCode ? `&ctry=${countryCode}` : '') +
|
|
46
|
-
(hashedEmailAddress ? `&z_e_sha2_l=${hashedEmailAddress}` : '');
|
|
47
|
-
this.loadScriptCount++;
|
|
48
|
-
return assetLoaderService.loadScript({
|
|
49
|
-
name: this.name,
|
|
50
|
-
loadMethod: AssetLoadMethod.TAG,
|
|
51
|
-
assetUrl: url
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
this.parameterFromKeyValue = (kv, keyValuesMap) => {
|
|
55
|
-
const value = keyValuesMap.get(kv.keyValueKey);
|
|
56
|
-
if (Array.isArray(value)) {
|
|
57
|
-
return `${kv.parameterKey}=${encodeURIComponent(value.join(','))}`;
|
|
58
|
-
}
|
|
59
|
-
return `${kv.parameterKey}=${encodeURIComponent(value || '')}`;
|
|
60
|
-
};
|
|
61
|
-
this.isExclusionKeyValueSet = (kv, keyValuesMap) => {
|
|
62
|
-
const value = keyValuesMap.get(kv.keyValueKey);
|
|
63
|
-
if (Array.isArray(value)) {
|
|
64
|
-
return value.indexOf(kv.disableOnValue) > -1;
|
|
65
|
-
}
|
|
66
|
-
return value === kv.disableOnValue;
|
|
67
|
-
};
|
|
68
|
-
this.makeKeyValuesMap = (keyValues) => {
|
|
69
|
-
return keyValues
|
|
70
|
-
? new Map(Object.keys(keyValues)
|
|
71
|
-
.map(key => [key, keyValues[key]])
|
|
72
|
-
.filter(([, value]) => !!value))
|
|
73
|
-
: new Map();
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
config__() {
|
|
77
|
-
return this.zeotapConfig;
|
|
78
|
-
}
|
|
79
|
-
configure__(moduleConfig) {
|
|
4
|
+
export const createZeotap = () => {
|
|
5
|
+
const name = 'zeotap';
|
|
6
|
+
const gvlid = 301;
|
|
7
|
+
let loadScriptCount = 0;
|
|
8
|
+
let zeotapConfig = null;
|
|
9
|
+
const config__ = () => zeotapConfig;
|
|
10
|
+
const configure__ = (moduleConfig) => {
|
|
80
11
|
if (moduleConfig?.zeotap && moduleConfig.zeotap.enabled) {
|
|
81
|
-
|
|
12
|
+
zeotapConfig = moduleConfig.zeotap;
|
|
82
13
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
14
|
+
};
|
|
15
|
+
const hasConsent = (tcData) => {
|
|
16
|
+
if (tcData.gdprApplies) {
|
|
17
|
+
return (tcData.vendor.consents[gvlid] &&
|
|
18
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.STORE_INFORMATION_ON_DEVICE] &&
|
|
19
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.CREATE_PERSONALISED_ADS_PROFILE] &&
|
|
20
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.SELECT_PERSONALISED_ADS] &&
|
|
21
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.CREATE_PERSONALISED_CONTENT_PROFILE] &&
|
|
22
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.SELECT_PERSONALISED_CONTENT] &&
|
|
23
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.MEASURE_AD_PERFORMANCE] &&
|
|
24
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.APPLY_MARKET_RESEARCH] &&
|
|
25
|
+
tcData.purpose.consents[tcfapi.responses.TCPurpose.DEVELOP_IMPROVE_PRODUCTS]);
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
};
|
|
29
|
+
const makeKeyValuesMap = (keyValues) => {
|
|
30
|
+
return keyValues
|
|
31
|
+
? new Map(Object.keys(keyValues)
|
|
32
|
+
.map(key => [key, keyValues[key]])
|
|
33
|
+
.filter(([, value]) => !!value))
|
|
34
|
+
: new Map();
|
|
35
|
+
};
|
|
36
|
+
const parameterFromKeyValue = (kv, keyValuesMap) => {
|
|
37
|
+
const value = keyValuesMap.get(kv.keyValueKey);
|
|
38
|
+
if (Array.isArray(value)) {
|
|
39
|
+
return `${kv.parameterKey}=${encodeURIComponent(value.join(','))}`;
|
|
40
|
+
}
|
|
41
|
+
return `${kv.parameterKey}=${encodeURIComponent(value || '')}`;
|
|
42
|
+
};
|
|
43
|
+
const isExclusionKeyValueSet = (kv, keyValuesMap) => {
|
|
44
|
+
const value = keyValuesMap.get(kv.keyValueKey);
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
return value.indexOf(kv.disableOnValue) > -1;
|
|
47
|
+
}
|
|
48
|
+
return value === kv.disableOnValue;
|
|
49
|
+
};
|
|
50
|
+
const loadScript = (config, assetLoaderService, moduleConfig) => {
|
|
51
|
+
const { mode, dataKeyValues, exclusionKeyValues, assetUrl, hashedEmailAddress, countryCode } = moduleConfig;
|
|
52
|
+
if (!assetLoaderService) {
|
|
53
|
+
return Promise.reject('Zeotap module :: no asset loader found, module not initialized yet?');
|
|
54
|
+
}
|
|
55
|
+
if (mode === 'default' && loadScriptCount > 0) {
|
|
56
|
+
return Promise.reject("Zeotap module :: can't reload script in default mode.");
|
|
57
|
+
}
|
|
58
|
+
const keyValuesMap = makeKeyValuesMap(config.targeting?.keyValues);
|
|
59
|
+
if (exclusionKeyValues.some(kv => isExclusionKeyValueSet(kv, keyValuesMap))) {
|
|
60
|
+
return Promise.reject('Zeotap module :: targeting exclusions prevented loading the script.');
|
|
61
|
+
}
|
|
62
|
+
const customData = dataKeyValues.map(kv => parameterFromKeyValue(kv, keyValuesMap)).join('&');
|
|
63
|
+
const loadIdPlus = !!moduleConfig.hashedEmailAddress && loadScriptCount === 0;
|
|
64
|
+
const url = assetUrl +
|
|
65
|
+
`&idp=${loadIdPlus ? 1 : 0}` +
|
|
66
|
+
(customData.length > 0 ? `&${customData}` : '') +
|
|
67
|
+
(countryCode ? `&ctry=${countryCode}` : '') +
|
|
68
|
+
(hashedEmailAddress ? `&z_e_sha2_l=${hashedEmailAddress}` : '');
|
|
69
|
+
loadScriptCount++;
|
|
70
|
+
return assetLoaderService.loadScript({
|
|
71
|
+
name,
|
|
72
|
+
loadMethod: AssetLoadMethod.TAG,
|
|
73
|
+
assetUrl: url
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const initSteps__ = () => {
|
|
77
|
+
const config = zeotapConfig;
|
|
86
78
|
return config && config.mode === 'default'
|
|
87
79
|
? [
|
|
88
|
-
mkInitStep(
|
|
89
|
-
if (
|
|
90
|
-
|
|
80
|
+
mkInitStep(name, context => {
|
|
81
|
+
if (hasConsent(context.tcData__)) {
|
|
82
|
+
loadScript(context.config__, context.assetLoaderService__, config).catch(error => context.logger__.error(name, error));
|
|
91
83
|
}
|
|
92
84
|
return Promise.resolve();
|
|
93
85
|
})
|
|
94
86
|
]
|
|
95
87
|
: [];
|
|
96
|
-
}
|
|
97
|
-
configureSteps__() {
|
|
98
|
-
const config =
|
|
88
|
+
};
|
|
89
|
+
const configureSteps__ = () => {
|
|
90
|
+
const config = zeotapConfig;
|
|
99
91
|
return config && config.mode === 'spa'
|
|
100
92
|
? [
|
|
101
|
-
mkConfigureStepOncePerRequestAdsCycle(
|
|
102
|
-
|
|
93
|
+
mkConfigureStepOncePerRequestAdsCycle(name, context => {
|
|
94
|
+
loadScript(context.config__, context.assetLoaderService__, config).catch(error => context.logger__.error(name, error));
|
|
103
95
|
return Promise.resolve();
|
|
104
96
|
})
|
|
105
97
|
]
|
|
106
98
|
: [];
|
|
107
|
-
}
|
|
108
|
-
prepareRequestAdsSteps__()
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
99
|
+
};
|
|
100
|
+
const prepareRequestAdsSteps__ = () => [];
|
|
101
|
+
return {
|
|
102
|
+
name,
|
|
103
|
+
description: 'Provides Zeotap functionality (data collection and identity plus) to Moli.',
|
|
104
|
+
moduleType: 'identity',
|
|
105
|
+
config__,
|
|
106
|
+
configure__,
|
|
107
|
+
initSteps__,
|
|
108
|
+
configureSteps__,
|
|
109
|
+
prepareRequestAdsSteps__
|
|
110
|
+
};
|
|
111
|
+
};
|
package/lib/ads/moli.js
CHANGED
|
@@ -193,38 +193,17 @@ export const createMoliTag = (window) => {
|
|
|
193
193
|
case 'configurable': {
|
|
194
194
|
const shouldInitialize = state.initialize;
|
|
195
195
|
const envOverride = getActiveEnvironmentOverride(window);
|
|
196
|
-
const modules = state.modules;
|
|
197
196
|
if (envOverride) {
|
|
198
197
|
state.runtimeConfig.environment = envOverride.value;
|
|
199
198
|
}
|
|
200
199
|
if (envOverride?.source === 'queryParam') {
|
|
201
200
|
setEnvironmentOverrideInStorage(envOverride.value, window.sessionStorage);
|
|
202
201
|
}
|
|
203
|
-
const log = getLogger(state.runtimeConfig, window);
|
|
204
|
-
log.debug('MoliGlobal', 'configure modules', config.modules ?? {});
|
|
205
|
-
modules.forEach(module => {
|
|
206
|
-
try {
|
|
207
|
-
module.configure__(config.modules ?? {});
|
|
208
|
-
log.debug('MoliGlobal', `configure ${module.moduleType} module ${module.name}`, module.config__());
|
|
209
|
-
state.runtimeConfig.adPipelineConfig.initSteps.push(...module.initSteps__());
|
|
210
|
-
state.runtimeConfig.adPipelineConfig.configureSteps.push(...module.configureSteps__());
|
|
211
|
-
state.runtimeConfig.adPipelineConfig.prepareRequestAdsSteps.push(...module.prepareRequestAdsSteps__());
|
|
212
|
-
if (module.requestBidsSteps__) {
|
|
213
|
-
state.runtimeConfig.adPipelineConfig.requestBidsSteps.push(...module.requestBidsSteps__());
|
|
214
|
-
}
|
|
215
|
-
if (module.prebidBidsBackHandler__) {
|
|
216
|
-
state.runtimeConfig.adPipelineConfig.prebidBidsBackHandler.push(...module.prebidBidsBackHandler__());
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
catch (e) {
|
|
220
|
-
log.error('MoliGlobal', `failed to configure ${module.moduleType} module ${module.name}`, e);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
202
|
state = {
|
|
224
203
|
state: 'configured',
|
|
225
204
|
config: config,
|
|
226
205
|
runtimeConfig: state.runtimeConfig,
|
|
227
|
-
modules: modules
|
|
206
|
+
modules: state.modules
|
|
228
207
|
};
|
|
229
208
|
if (shouldInitialize || config.requestAds === true) {
|
|
230
209
|
return requestAds();
|
|
@@ -259,6 +238,40 @@ export const createMoliTag = (window) => {
|
|
|
259
238
|
case 'configured': {
|
|
260
239
|
setABtestTargeting();
|
|
261
240
|
addDomainLabel(state.config.domain);
|
|
241
|
+
const modules = state.modules;
|
|
242
|
+
getLogger(state.runtimeConfig, window).debug('MoliGlobal', 'configure modules', state.config.modules ?? {});
|
|
243
|
+
const labelService = createLabelConfigService(state.config?.labelSizeConfig || [], state.runtimeConfig.labels, window);
|
|
244
|
+
modules
|
|
245
|
+
.filter(module => {
|
|
246
|
+
const moduleName = module.name;
|
|
247
|
+
const moduleConfig = state.config?.modules?.[moduleName];
|
|
248
|
+
if (moduleConfig?.labelCondition) {
|
|
249
|
+
const areLabelConditionsMet = labelService.isLabelConditionMet(moduleConfig.labelCondition);
|
|
250
|
+
if (!areLabelConditionsMet) {
|
|
251
|
+
getLogger(state.runtimeConfig, window).debug('MoliGlobal', `skipping configuration of ${module.moduleType} module ${moduleName} due to label condition not met.`);
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
256
|
+
})
|
|
257
|
+
.forEach(module => {
|
|
258
|
+
try {
|
|
259
|
+
module.configure__(state.config?.modules ?? {});
|
|
260
|
+
getLogger(state.runtimeConfig, window).debug('MoliGlobal', `configure ${module.moduleType} module ${module.name}`, module.config__());
|
|
261
|
+
state.runtimeConfig.adPipelineConfig.initSteps.push(...module.initSteps__());
|
|
262
|
+
state.runtimeConfig.adPipelineConfig.configureSteps.push(...module.configureSteps__());
|
|
263
|
+
state.runtimeConfig.adPipelineConfig.prepareRequestAdsSteps.push(...module.prepareRequestAdsSteps__());
|
|
264
|
+
if (module.requestBidsSteps__) {
|
|
265
|
+
state.runtimeConfig.adPipelineConfig.requestBidsSteps.push(...module.requestBidsSteps__());
|
|
266
|
+
}
|
|
267
|
+
if (module.prebidBidsBackHandler__) {
|
|
268
|
+
state.runtimeConfig.adPipelineConfig.prebidBidsBackHandler.push(...module.prebidBidsBackHandler__());
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (e) {
|
|
272
|
+
getLogger(state.runtimeConfig, window).error('MoliGlobal', `failed to configure ${module.moduleType} module ${module.name}`, e);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
262
275
|
const { refreshInfiniteSlots } = state.runtimeConfig;
|
|
263
276
|
let config = state.config;
|
|
264
277
|
if (refreshInfiniteSlots.length > 0) {
|
package/lib/bundle/adReload.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createAdReload } from '../ads/modules/ad-reload';
|
|
2
|
+
window.moli.registerModule(createAdReload());
|
package/lib/bundle/adex.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createAdexModule } from '../ads/modules/adex';
|
|
2
|
+
window.moli.registerModule(createAdexModule());
|
package/lib/bundle/cleanup.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createCleanup } from '../ads/modules/cleanup';
|
|
2
|
+
window.moli.registerModule(createCleanup());
|
package/lib/bundle/confiant.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createConfiant } from '../ads/modules/confiant';
|
|
2
|
+
window.moli.registerModule(createConfiant());
|
package/lib/bundle/emetriq.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createEmetriq } from 'ad-tag/ads/modules/emetriq';
|
|
2
|
+
window.moli.registerModule(createEmetriq());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createIdentityLink } from 'ad-tag/ads/modules/identitylink';
|
|
2
|
+
window.moli.registerModule(createIdentityLink());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createPrebidFirstPartyDataModule } from 'ad-tag/ads/modules/prebid-first-party-data';
|
|
2
|
+
window.moli.registerModule(createPrebidFirstPartyDataModule());
|
package/lib/bundle/pubstack.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createPubstack } from '../ads/modules/pubstack';
|
|
2
|
+
window.moli.registerModule(createPubstack());
|
package/lib/bundle/skin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createSkin } from '../ads/modules/generic-skin';
|
|
2
|
+
window.moli.registerModule(createSkin());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createStickyFooterAd } from 'ad-tag/ads/modules/sticky-footer-ad';
|
|
2
|
+
window.moli.registerModule(createStickyFooterAd());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createStickyFooterAdsV2 } from 'ad-tag/ads/modules/sticky-footer-ad-v2';
|
|
2
|
+
window.moli.registerModule(createStickyFooterAdsV2());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createStickyHeaderAd } from 'ad-tag/ads/modules/sticky-header-ad';
|
|
2
|
+
window.moli.registerModule(createStickyHeaderAd());
|
package/lib/bundle/zeotap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
window.moli.registerModule(
|
|
1
|
+
import { createZeotap } from 'ad-tag/ads/modules/zeotap';
|
|
2
|
+
window.moli.registerModule(createZeotap());
|
package/lib/gen/packageJson.js
CHANGED
package/lib/types/prebidjs.js
CHANGED
|
@@ -2,6 +2,7 @@ export const BrowserStorageKeys = {
|
|
|
2
2
|
moliEnv: 'moli-env',
|
|
3
3
|
moliPubCode: 'moli-pub-code',
|
|
4
4
|
moliVersion: 'moli-version',
|
|
5
|
+
molyAnalyticsSession: 'moli-analytics-session',
|
|
5
6
|
testSlotSize: (id) => `moli-test-slot-size-${id}`,
|
|
6
7
|
debugDelay: 'moli-debug-delay',
|
|
7
8
|
abTest: 'moli-ab-test'
|