mod-build 4.0.76-beta.2 → 4.0.76-beta.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.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/scripts/globals.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useDynamicGtm } from './default/use-dynamic-gtm.js';
|
|
2
1
|
import { updateFooterLinkPaths } from './default/update-link-paths.js';
|
|
3
2
|
import { preventRageClicks } from './default/rage-clicking.js';
|
|
4
3
|
import { showUtilityProviders } from './default/show-utility-providers.js';
|
|
5
4
|
|
|
6
5
|
function globalFunctions(config) {
|
|
7
|
-
|
|
6
|
+
window.gtm_container_ID = config.gtm_container_ID;
|
|
8
7
|
updateFooterLinkPaths(config);
|
|
9
8
|
}
|
|
10
9
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import hasQsParams from '../has-qs-params.js';
|
|
2
|
-
import updateMediaSpecificGtm from '../update-media-specific-gtm.js';
|
|
3
|
-
|
|
4
|
-
export const useDynamicGtm = (config) => {
|
|
5
|
-
const { page } = config;
|
|
6
|
-
if (page.headConfig.useDynamicGtm || typeof window.isQSPage === 'undefined') {
|
|
7
|
-
hasQsParams();
|
|
8
|
-
window.gtm_container_ID = window.isQSPage ? config.qs_gtm_container_ID : config.gtm_container_ID;
|
|
9
|
-
if (page.headConfig.updateMediaSpecificGtm) {
|
|
10
|
-
updateMediaSpecificGtm(page.headConfig.updateMediaSpecificGtm);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Load GTM tag dynamically MOD vs QS by checking the quad parameters on URL **/
|
|
2
|
-
export const searchParams = new URLSearchParams(window.location.search);
|
|
3
|
-
export const qsParams = ['CLK', 'CCID', 'QTR', 'quadlink'];
|
|
4
|
-
|
|
5
|
-
export default function() {
|
|
6
|
-
return window.isQSPage = qsParams.some(param => searchParams.has(param));
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export default function (trafficChannels) {
|
|
2
|
-
// trafficChannels is an array of media channels to enable this feature, e.g. ['sem', 'avm'] - we are going to remove this param after testing
|
|
3
|
-
const gtmContainers = {
|
|
4
|
-
'sem': 'GTM-5WM2R5WC',
|
|
5
|
-
'avm': 'GTM-TBJV3H',
|
|
6
|
-
'pub': 'GTM-TBJV3H'
|
|
7
|
-
};
|
|
8
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
9
|
-
const queryParams = Object.fromEntries(urlParams.entries());
|
|
10
|
-
const url = window.location.href.replace(window.location.hash, '');
|
|
11
|
-
const hasSemIdentifiers = url.includes('gclid') || url.includes('msclkid') || url.includes('=SEM') || url.includes('=sem');
|
|
12
|
-
// const hasQuadlink = 'quadlink' in queryParams; - keeping it for future use
|
|
13
|
-
const hasCCIDorCLK = 'ccid' in queryParams || 'clk' in queryParams;
|
|
14
|
-
const hasAVMParam = queryParams.channel && queryParams.channel.toLowerCase() === 'avm';
|
|
15
|
-
let mediaChannel = 'pub';
|
|
16
|
-
|
|
17
|
-
if (hasAVMParam) {
|
|
18
|
-
mediaChannel = 'avm';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (hasSemIdentifiers && !hasCCIDorCLK && !hasAVMParam) {
|
|
22
|
-
mediaChannel = 'sem';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (trafficChannels.includes(mediaChannel) && gtmContainers[mediaChannel]) {
|
|
26
|
-
window.gtm_container_ID = gtmContainers[mediaChannel];
|
|
27
|
-
}
|
|
28
|
-
}
|