This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function protectDataLayer() { | |
| window._internalDataLayer = window.dataLayer || []; | |
| // Wrap the array in a Proxy to detect internal changes | |
| const dataLayerProxy = new Proxy(window._internalDataLayer, { | |
| set(target, prop, value, receiver) { | |
| console.log(`[dataLayer] Change detected: "${prop}" set to`, value); | |
| return Reflect.set(target, prop, value, receiver); | |
| }, | |
| get(target, prop, receiver) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| const targetScript = "gtm.js"; | |
| function fmt(ms) { return ms.toFixed(2) + "ms"; } | |
| // Poll performance entries until we find GTM.js | |
| const checkInterval = 50; // ms | |
| const maxAttempts = 100; // ~5 seconds max | |
| let attempts = 0; |
OlderNewer