eluminate.js (2647B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1606448 - Shim CoreMetrics Eluminate analytics 9 * 10 * Sites may rely on eluminate.js tracking in ways which cause breakage, 11 * which has been seen on shopping sites such as Vans.com, where the 12 * search filtering UX is broken. This shim mitigates such breakage. 13 */ 14 15 if (!window.CM_DDX) { 16 window.CM_DDX = { 17 domReadyFired: false, 18 headScripts: true, 19 dispatcherLoadRequested: false, 20 firstPassFunctionBinding: false, 21 BAD_PAGE_ID_ELAPSED_TIMEOUT: 5000, 22 version: -1, 23 standalone: false, 24 test: { 25 syndicate: true, 26 testCounter: "", 27 doTest: false, 28 newWin: false, 29 process: () => {}, 30 }, 31 partner: {}, 32 invokeFunctionWhenAvailable: a => { 33 a(); 34 }, 35 gup: _d => "", 36 privacy: { 37 isDoNotTrackEnabled: () => false, 38 setDoNotTrack: () => {}, 39 getDoNotTrack: () => false, 40 }, 41 setSubCookie: () => {}, 42 }; 43 const noopfn = () => {}; 44 const w = window; 45 w.cmAddShared = noopfn; 46 w.cmCalcSKUString = noopfn; 47 w.cmCreateManualImpressionTag = noopfn; 48 w.cmCreateManualLinkClickTag = noopfn; 49 w.cmCreateManualPageviewTag = noopfn; 50 w.cmCreateOrderTag = noopfn; 51 w.cmCreatePageviewTag = noopfn; 52 w.cmExecuteTagQueue = noopfn; 53 w.cmRetrieveUserID = noopfn; 54 w.cmSetClientID = noopfn; 55 w.cmSetCurrencyCode = noopfn; 56 w.cmSetFirstPartyIDs = noopfn; 57 w.cmSetSubCookie = noopfn; 58 w.cmSetupCookieMigration = noopfn; 59 w.cmSetupNormalization = noopfn; 60 w.cmSetupOther = noopfn; 61 w.cmStartTagSet = noopfn; 62 w.cmCreateConversionEventTag = noopfn; 63 w.cmCreateDefaultPageviewTag = noopfn; 64 w.cmCreateElementTag = noopfn; 65 w.cmCreateManualImpressionTag = noopfn; 66 w.cmCreateManualLinkClickTag = noopfn; 67 w.cmCreateManualPageviewTag = noopfn; 68 w.cmCreatePageElementTag = noopfn; 69 w.cmCreatePageviewTag = noopfn; 70 w.cmCreateProductElementTag = noopfn; 71 w.cmCreateProductviewTag = noopfn; 72 w.cmCreateTechPropsTag = noopfn; 73 w.cmLoadIOConfig = noopfn; 74 w.cmSetClientID = noopfn; 75 w.cmSetCurrencyCode = noopfn; 76 w.cmSetFirstPartyIDs = noopfn; 77 w.cmSetupCookieMigration = noopfn; 78 w.cmSetupNormalization = noopfn; 79 80 w.cmSetupOther = b => { 81 for (const a in b) { 82 window[a] = b[a]; 83 } 84 }; 85 86 const techProps = {}; 87 88 w.coremetrics = { 89 cmLastReferencedPageID: "", 90 cmLoad: noopfn, 91 cmUpdateConfig: noopfn, 92 getTechProps: () => techProps, 93 isDef: c => typeof c !== "undefined" && c, 94 }; 95 }