@highfivve/ad-tag 5.13.3 → 5.13.5
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.
|
@@ -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.browserBlockList ? { browserBlackList: config.browserBlockList } : {}),
|
|
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
|
+
};
|
|
@@ -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.browserBlockList && (React.createElement(Row, { label: "Browser blocklist" },
|
|
184
|
+
React.createElement(ListTags, { values: config.browserBlockList.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