@highfivve/ad-tag 5.13.5 → 5.13.6

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.
@@ -4,6 +4,7 @@ const gvlid = '1323';
4
4
  const name = 'intentiq';
5
5
  export const createIntentIq = () => {
6
6
  let intentIqConfig = null;
7
+ let analyticsEnabled = false;
7
8
  const hasVendorConsent = (context) => !context.tcData__.gdprApplies || Boolean(context.tcData__.vendor.consents[gvlid]);
8
9
  const loadIntentIqScript = (config, context) => {
9
10
  if (context.env__ === 'test' || !config.scriptUrl) {
@@ -21,7 +22,26 @@ export const createIntentIq = () => {
21
22
  })
22
23
  .catch(error => context.logger__.error('failed to load intentiq', error));
23
24
  };
24
- const mkUserIdProvider = (config, context) => ({
25
+ const mkIntentIqConfig = (config, context) => ({
26
+ partner: config.partner,
27
+ region: 'gdpr',
28
+ ...(context.adUnitPathVariables__.domain
29
+ ? { domainName: context.adUnitPathVariables__.domain }
30
+ : {}),
31
+ ...(config.browserBlockList ? { browserBlackList: config.browserBlockList } : {}),
32
+ ...(config.abPercentage === undefined ? {} : { abPercentage: config.abPercentage }),
33
+ ...(config.ABTestingConfigurationSource
34
+ ? { ABTestingConfigurationSource: config.ABTestingConfigurationSource }
35
+ : {}),
36
+ ...(config.group ? { group: config.group } : {}),
37
+ ...(config.gamParameterName
38
+ ? {
39
+ gamParameterName: config.gamParameterName,
40
+ gamObjectReference: context.window__.googletag
41
+ }
42
+ : {})
43
+ });
44
+ const mkUserIdProvider = (config, intentIqConfigObject) => ({
25
45
  name: 'intentIqId',
26
46
  storage: {
27
47
  type: 'html5',
@@ -29,49 +49,39 @@ export const createIntentIq = () => {
29
49
  expires: config.storage?.expires ?? 0,
30
50
  refreshInSeconds: config.storage?.refreshInSeconds ?? 0
31
51
  },
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
- }
52
+ params: intentIqConfigObject
51
53
  });
52
- const configureUserId = (config, context) => {
54
+ const configurePrebid = (config, context) => {
53
55
  if (context.env__ === 'test' || !context.config__.prebid) {
54
56
  return Promise.resolve();
55
57
  }
56
58
  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');
59
+ context.logger__.warn('IntentIQ', 'no domain ad unit path variable set. IntentIQ will be configured without a domainName');
58
60
  }
61
+ const intentIqConfigObject = mkIntentIqConfig(config, context);
59
62
  context.window__.pbjs.que.push(() => {
60
63
  const userIds = context.window__.pbjs.getConfig().userSync?.userIds;
61
64
  if (userIds?.some(userId => userId.name === 'intentIqId')) {
62
65
  context.logger__.debug('IntentIQ', 'intentIqId userId provider already configured');
63
- return;
64
66
  }
65
- context.window__.pbjs.mergeConfig({
66
- userSync: { userIds: [mkUserIdProvider(config, context)] }
67
- });
67
+ else {
68
+ context.window__.pbjs.mergeConfig({
69
+ userSync: { userIds: [mkUserIdProvider(config, intentIqConfigObject)] }
70
+ });
71
+ }
72
+ if (!analyticsEnabled) {
73
+ analyticsEnabled = true;
74
+ context.window__.pbjs.enableAnalytics([
75
+ { provider: 'iiqAnalytics', options: intentIqConfigObject }
76
+ ]);
77
+ }
68
78
  });
69
79
  return Promise.resolve();
70
80
  };
71
81
  return {
72
82
  name,
73
83
  configKey: 'intentiq',
74
- description: 'Configures the IntentIQ prebid userId submodule',
84
+ description: 'Configures the IntentIQ prebid userId submodule and analytics adapter',
75
85
  moduleType: 'identity',
76
86
  config__() {
77
87
  return intentIqConfig;
@@ -96,7 +106,7 @@ export const createIntentIq = () => {
96
106
  const config = intentIqConfig;
97
107
  return config
98
108
  ? [
99
- mkConfigureStepOncePerRequestAdsCycle(`${name}-configure`, ctx => configureUserId(config, ctx))
109
+ mkConfigureStepOncePerRequestAdsCycle(`${name}-configure`, ctx => configurePrebid(config, ctx))
100
110
  ]
101
111
  : [];
102
112
  },
@@ -1,3 +1,3 @@
1
1
  export const packageJson = {
2
- version: '5.13.5'
2
+ version: '5.13.6'
3
3
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highfivve/ad-tag",
3
- "version": "5.13.5",
3
+ "version": "5.13.6",
4
4
  "license": "Apache-2.0",
5
5
  "description": "An ad tag implementation called moli",
6
6
  "main": "./lib/index.js",