@highfivve/ad-tag 5.13.2 → 5.13.4
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/modules/intentiq/index.js +107 -0
- package/lib/ads/modules/sticky-footer-ad-v2/footerStickyAd.js +8 -5
- package/lib/ads/modules/sticky-footer-ad-v2/index.js +2 -1
- package/lib/ads/modules/sticky-header-ad/renderResult.js +10 -1
- package/lib/bundle/intentIq.js +2 -0
- package/lib/console/components/moduleConfigs.js +18 -0
- package/lib/gen/packageJson.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { mkConfigureStepOncePerRequestAdsCycle, mkInitStep } from 'ad-tag/ads/adPipeline';
|
|
2
|
+
import { AssetLoadMethod } from 'ad-tag/util/assetLoaderService';
|
|
3
|
+
const gvlid = '1323';
|
|
4
|
+
const name = 'intentiq';
|
|
5
|
+
export const createIntentIq = () => {
|
|
6
|
+
let intentIqConfig = null;
|
|
7
|
+
const hasVendorConsent = (context) => !context.tcData__.gdprApplies || Boolean(context.tcData__.vendor.consents[gvlid]);
|
|
8
|
+
const loadIntentIqScript = (config, context) => {
|
|
9
|
+
if (context.env__ === 'test' || !config.scriptUrl) {
|
|
10
|
+
return Promise.resolve();
|
|
11
|
+
}
|
|
12
|
+
if (!hasVendorConsent(context)) {
|
|
13
|
+
context.logger__.debug('IntentIQ', 'no vendor consent. Skipping script loading');
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
}
|
|
16
|
+
return context.assetLoaderService__
|
|
17
|
+
.loadScript({
|
|
18
|
+
name,
|
|
19
|
+
assetUrl: config.scriptUrl,
|
|
20
|
+
loadMethod: AssetLoadMethod.TAG
|
|
21
|
+
})
|
|
22
|
+
.catch(error => context.logger__.error('failed to load intentiq', error));
|
|
23
|
+
};
|
|
24
|
+
const mkUserIdProvider = (config, context) => ({
|
|
25
|
+
name: 'intentIqId',
|
|
26
|
+
storage: {
|
|
27
|
+
type: 'html5',
|
|
28
|
+
name: 'intentIqId',
|
|
29
|
+
expires: config.storage?.expires ?? 0,
|
|
30
|
+
refreshInSeconds: config.storage?.refreshInSeconds ?? 0
|
|
31
|
+
},
|
|
32
|
+
params: {
|
|
33
|
+
partner: config.partner,
|
|
34
|
+
region: 'gdpr',
|
|
35
|
+
...(context.adUnitPathVariables__.domain
|
|
36
|
+
? { domainName: context.adUnitPathVariables__.domain }
|
|
37
|
+
: {}),
|
|
38
|
+
...(config.browserBlackList ? { browserBlackList: config.browserBlackList } : {}),
|
|
39
|
+
...(config.abPercentage === undefined ? {} : { abPercentage: config.abPercentage }),
|
|
40
|
+
...(config.ABTestingConfigurationSource
|
|
41
|
+
? { ABTestingConfigurationSource: config.ABTestingConfigurationSource }
|
|
42
|
+
: {}),
|
|
43
|
+
...(config.group ? { group: config.group } : {}),
|
|
44
|
+
...(config.gamParameterName
|
|
45
|
+
? {
|
|
46
|
+
gamParameterName: config.gamParameterName,
|
|
47
|
+
gamObjectReference: context.window__.googletag
|
|
48
|
+
}
|
|
49
|
+
: {})
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const configureUserId = (config, context) => {
|
|
53
|
+
if (context.env__ === 'test' || !context.config__.prebid) {
|
|
54
|
+
return Promise.resolve();
|
|
55
|
+
}
|
|
56
|
+
if (!context.adUnitPathVariables__.domain) {
|
|
57
|
+
context.logger__.warn('IntentIQ', 'no domain ad unit path variable set. The intentIqId provider will be configured without a domainName');
|
|
58
|
+
}
|
|
59
|
+
context.window__.pbjs.que.push(() => {
|
|
60
|
+
const userIds = context.window__.pbjs.getConfig().userSync?.userIds;
|
|
61
|
+
if (userIds?.some(userId => userId.name === 'intentIqId')) {
|
|
62
|
+
context.logger__.debug('IntentIQ', 'intentIqId userId provider already configured');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
context.window__.pbjs.mergeConfig({
|
|
66
|
+
userSync: { userIds: [mkUserIdProvider(config, context)] }
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
return Promise.resolve();
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
name,
|
|
73
|
+
configKey: 'intentiq',
|
|
74
|
+
description: 'Configures the IntentIQ prebid userId submodule',
|
|
75
|
+
moduleType: 'identity',
|
|
76
|
+
config__() {
|
|
77
|
+
return intentIqConfig;
|
|
78
|
+
},
|
|
79
|
+
configure__(moduleConfig) {
|
|
80
|
+
if (moduleConfig?.intentiq && moduleConfig.intentiq.enabled) {
|
|
81
|
+
intentIqConfig = moduleConfig.intentiq;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
initSteps__() {
|
|
85
|
+
const config = intentIqConfig;
|
|
86
|
+
return config
|
|
87
|
+
? [
|
|
88
|
+
mkInitStep(name, ctx => {
|
|
89
|
+
loadIntentIqScript(config, ctx);
|
|
90
|
+
return Promise.resolve();
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
: [];
|
|
94
|
+
},
|
|
95
|
+
configureSteps__() {
|
|
96
|
+
const config = intentIqConfig;
|
|
97
|
+
return config
|
|
98
|
+
? [
|
|
99
|
+
mkConfigureStepOncePerRequestAdsCycle(`${name}-configure`, ctx => configureUserId(config, ctx))
|
|
100
|
+
]
|
|
101
|
+
: [];
|
|
102
|
+
},
|
|
103
|
+
prepareRequestAdsSteps__() {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { isAdvertiserIncluded } from 'ad-tag/ads/isAdvertiserIncluded';
|
|
2
|
+
import { isGamAnchor } from 'ad-tag/ads/auctions/anchorContext';
|
|
2
3
|
const adStickyContainerDataRef = '[data-ref=h5v-sticky-ad]';
|
|
3
4
|
const adStickyCloseButtonDataRef = '[data-ref=h5v-sticky-ad-close]';
|
|
4
5
|
const adStickyCloseButtonContent = '.h5v-closeButtonContent';
|
|
5
6
|
const adStickyHidingClass = 'h5v-footerAd--hidden';
|
|
6
7
|
const desktopInitialHidingClass = 'h5v-footerAd--hidden-d';
|
|
7
8
|
const mobileInitialHidingClass = 'h5v-footerAd--hidden-m';
|
|
8
|
-
const
|
|
9
|
+
const isStickySlotEvent = (slot, mobileStickyDomId, resolvedAdUnitPath, channel, window) => slot.getSlotElementId() === mobileStickyDomId ||
|
|
10
|
+
(channel === 'gam' && isGamAnchor(slot, window) && slot.getAdUnitPath() === resolvedAdUnitPath);
|
|
11
|
+
const stickyRenderedEvent = (mobileStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window) => new Promise(resolve => {
|
|
9
12
|
const listener = (event) => {
|
|
10
|
-
if (event.slot
|
|
13
|
+
if (!isStickySlotEvent(event.slot, mobileStickyDomId, resolvedAdUnitPath, channel, window)) {
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
16
|
if (channel === 'gam') {
|
|
@@ -44,7 +47,7 @@ const hideAdSlot = (element) => {
|
|
|
44
47
|
const showAdSlot = (element) => {
|
|
45
48
|
element.classList.remove(adStickyHidingClass, desktopInitialHidingClass, mobileInitialHidingClass);
|
|
46
49
|
};
|
|
47
|
-
export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdvertiserIds, channel, closingButtonText) => {
|
|
50
|
+
export const initAdSticky = (window, env, log, footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, closingButtonText) => {
|
|
48
51
|
const stickyAd = 'sticky-ad';
|
|
49
52
|
const adSticky = window.document.querySelector(adStickyContainerDataRef);
|
|
50
53
|
const closeButton = window.document.querySelector(adStickyCloseButtonDataRef);
|
|
@@ -91,7 +94,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
|
|
|
91
94
|
else if (renderResult === 'standard') {
|
|
92
95
|
showAdSlot(adSticky);
|
|
93
96
|
const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
|
|
94
|
-
return stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
|
|
97
|
+
return stickyRenderedEvent(footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window)
|
|
95
98
|
.then(result => result === 'empty' || result === 'disallowed'
|
|
96
99
|
? Promise.resolve(result)
|
|
97
100
|
: stickyOnLoadEventPromise.then(() => result))
|
|
@@ -102,7 +105,7 @@ export const initAdSticky = (window, env, log, footerStickyDomId, disallowedAdve
|
|
|
102
105
|
if (env === 'production') {
|
|
103
106
|
if (footerStickyDomId) {
|
|
104
107
|
const stickyOnLoadEventPromise = stickyOnLoadEvent(footerStickyDomId, window);
|
|
105
|
-
stickyRenderedEvent(footerStickyDomId, disallowedAdvertiserIds, channel, window)
|
|
108
|
+
stickyRenderedEvent(footerStickyDomId, resolvedAdUnitPath, disallowedAdvertiserIds, channel, window)
|
|
106
109
|
.then(result => result === 'empty' || result === 'disallowed'
|
|
107
110
|
? Promise.resolve(result)
|
|
108
111
|
: stickyOnLoadEventPromise.then(() => result))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LOW_PRIORITY, mkPrepareRequestAdsStep } from 'ad-tag/ads/adPipeline';
|
|
2
|
+
import { resolveAdUnitPath } from 'ad-tag/ads/adUnitPath';
|
|
2
3
|
import { initAdSticky } from './footerStickyAd';
|
|
3
4
|
export const createStickyFooterAdsV2 = () => {
|
|
4
5
|
const name = 'sticky-footer-ads-v2';
|
|
@@ -22,7 +23,7 @@ export const createStickyFooterAdsV2 = () => {
|
|
|
22
23
|
}
|
|
23
24
|
if (footerAdSlot) {
|
|
24
25
|
const channel = ctx.auction__.anchorBottomChannel(footerAdSlot.moliSlot.domId);
|
|
25
|
-
initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, config.disallowedAdvertiserIds, channel, config.closingButtonText);
|
|
26
|
+
initAdSticky(ctx.window__, ctx.env__, ctx.logger__, footerAdSlot.moliSlot.domId, resolveAdUnitPath(footerAdSlot.moliSlot.adUnitPath, ctx.adUnitPathVariables__), config.disallowedAdvertiserIds, channel, config.closingButtonText);
|
|
26
27
|
}
|
|
27
28
|
return Promise.resolve();
|
|
28
29
|
})
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { isAdvertiserIncluded } from 'ad-tag/ads/isAdvertiserIncluded';
|
|
2
|
+
import { resolveAdUnitPath } from 'ad-tag/ads/adUnitPath';
|
|
3
|
+
import { isGamAnchor } from 'ad-tag/ads/auctions/anchorContext';
|
|
2
4
|
export const adRenderResult = (ctx, headerSlot, disallowedAdvertiserIds, channel, minVisibleDuration) => new Promise(resolve => {
|
|
3
5
|
if (ctx.env__ === 'test') {
|
|
4
6
|
resolve('standard');
|
|
5
7
|
return;
|
|
6
8
|
}
|
|
9
|
+
const resolvedAdUnitPath = channel === 'gam'
|
|
10
|
+
? resolveAdUnitPath(headerSlot.adUnitPath, ctx.adUnitPathVariables__)
|
|
11
|
+
: null;
|
|
12
|
+
const isHeaderSlotEvent = (slot) => slot.getSlotElementId() === headerSlot.domId ||
|
|
13
|
+
(resolvedAdUnitPath !== null &&
|
|
14
|
+
isGamAnchor(slot, ctx.window__) &&
|
|
15
|
+
slot.getAdUnitPath() === resolvedAdUnitPath);
|
|
7
16
|
const listener = event => {
|
|
8
|
-
if (event.slot
|
|
17
|
+
if (!isHeaderSlotEvent(event.slot)) {
|
|
9
18
|
return;
|
|
10
19
|
}
|
|
11
20
|
if (channel === 'gam') {
|
|
@@ -167,6 +167,23 @@ const IdentityLinkModule = ({ config }) => (React.createElement(React.Fragment,
|
|
|
167
167
|
React.createElement(Tag, { variant: config.hashedEmailAddresses.length > 0 ? 'green' : 'grey' },
|
|
168
168
|
config.hashedEmailAddresses.length,
|
|
169
169
|
" provided"))));
|
|
170
|
+
const IntentIqModule = ({ config }) => (React.createElement(React.Fragment, null,
|
|
171
|
+
React.createElement(Row, { label: "Partner" },
|
|
172
|
+
React.createElement(Tag, null, config.partner)),
|
|
173
|
+
config.gamParameterName && (React.createElement(Row, { label: "GAM parameter" },
|
|
174
|
+
React.createElement(Tag, null, config.gamParameterName))),
|
|
175
|
+
(config.ABTestingConfigurationSource || config.group || config.abPercentage !== undefined) && (React.createElement(Row, { label: "A/B testing" },
|
|
176
|
+
config.ABTestingConfigurationSource && (React.createElement(Tag, { variant: "blue" }, config.ABTestingConfigurationSource)),
|
|
177
|
+
config.group && React.createElement(Tag, { variant: "grey" },
|
|
178
|
+
"group ",
|
|
179
|
+
config.group),
|
|
180
|
+
config.abPercentage !== undefined && React.createElement(Tag, { variant: "grey" },
|
|
181
|
+
config.abPercentage,
|
|
182
|
+
"%"))),
|
|
183
|
+
config.browserBlackList && (React.createElement(Row, { label: "Browser blacklist" },
|
|
184
|
+
React.createElement(ListTags, { values: config.browserBlackList.split(','), variant: "grey" }))),
|
|
185
|
+
config.scriptUrl && (React.createElement(Row, { label: "Script URL" },
|
|
186
|
+
React.createElement(Tag, null, config.scriptUrl)))));
|
|
170
187
|
const PubstackModule = ({ config }) => (React.createElement(Row, { label: "Tag ID" },
|
|
171
188
|
React.createElement(Tag, null, config.tagId)));
|
|
172
189
|
const SkinModule = ({ config }) => (React.createElement(React.Fragment, null, config.configs.map((skinConfig, index) => (React.createElement(Fragment, { key: index },
|
|
@@ -348,6 +365,7 @@ const moduleComponents = {
|
|
|
348
365
|
geoedge: GeoEdgeModule,
|
|
349
366
|
identitylink: IdentityLinkModule,
|
|
350
367
|
inlineAi: InlineAiModule,
|
|
368
|
+
intentiq: IntentIqModule,
|
|
351
369
|
pubstack: PubstackModule,
|
|
352
370
|
skin: SkinModule,
|
|
353
371
|
styles: StylesModule,
|
package/lib/gen/packageJson.js
CHANGED