1if (typeof Object.assign != 'function') { 2 Object.assign = function(target) { 3 'use strict'; 4 if (target == null) { 5 throw new TypeError('Cannot convert undefined or null to object'); 6 } 7 8 target = Object(target); 9 for (var index = 1; index < arguments.length; index++) { 10 var source = arguments[index]; 11 if (source != null) { 12 for (var key in source) { 13 if (Object.prototype.hasOwnProperty.call(source, key)) { 14 target[key] = source[key]; 15 } 16 } 17 } 18 } 19 return target; 20 }; 21} 22 23window.dataLayer = window.dataLayer || []; 24var browserInfo = navigator.userAgent; 25var isIE = /MSIE \d|Trident.*rv:/.test(browserInfo); 26var isAndroid = browserInfo.indexOf("MRBLUE_ANDROID") > -1; 27var isIOS = browserInfo.indexOf("MRBLUE_IOS") > -1; 28var isApp = isAndroid || isIOS; 29var isCompleteApp = browserInfo.indexOf("MRBLUE_ANDROID_") > -1; 30var isGTMLoad = false; 31var commonData = {}; 32var virCommonData = {}; 33var mowebClickEventPrefix = 'MOWEB_'; 34var moappClickEventPrefix = 'APP_' + (isCompleteApp ? 'ìì í_' : 'ì¼ë°_'); 35var isLogging = false; 36 37function removeEmptyElement(removeValue) { 38 var returnValue = {}; 39 for (var key in removeValue) { 40 if (removeValue.hasOwnProperty(key)) { 41 if ( 42 removeValue[key] !== "" && 43 removeValue[key] !== null && 44 removeValue[key] !== undefined 45 ) { 46 returnValue[key] = removeValue[key]; 47 } 48 } 49 } 50 return returnValue; 51} 52 53function resetDataLayer(targetObject) { 54 var setGTM = {}; 55 for (var key in targetObject) { 56 if (targetObject.hasOwnProperty(key)) { 57 setGTM[key] = undefined; 58 } 59 } 60 return dataLayer.push(setGTM); 61} 62 63function hybrid(object, isVirtual) { 64 var GAData = isVirtual 65 ? Object.assign({}, virCommonData, object) 66 : Object.assign({}, commonData, object); 67 var GADataString = JSON.stringify(GAData); 68 69 if (window.flutter_inappwebview) { 70 window.flutter_inappwebview.callHandler("mrbluegascriptAndroid", GADataString); 71 } 72 // legacy app compatibility 73 else if (isAndroid) { 74 window.mrbluegascriptAndroid.GAHybrid(GADataString); 75 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.mrbluegascriptCallbackHandler) { 76 window.webkit.messageHandlers.mrbluegascriptCallbackHandler.postMessage(GADataString); 77 } 78} 79 80function replaceToMobileAppEventPage(object, targetString, replacementString) { 81 for (var key in object) { 82 if (object.hasOwnProperty(key)) { 83 if (typeof object[key] === "object" && object[key] !== null) { 84 replaceStringInObject(object[key], targetString, replacementString); 85 } 86 else if (typeof object[key] === "string") { 87 if (object[key].indexOf(targetString) > -1) { 88 object[key] = object[key].replace(new RegExp(targetString, 'g'), replacementString); 89 } 90 } 91 } 92 } 93 return object; 94} 95 96function sendGAPage(object) { 97 if (isIE) return; 98 99 debug('sendGAPage', object); 100 101 try { 102 var GAData = removeEmptyElement(object); 103 commonData = Object.assign({}, object); 104 if (isApp) { 105 GAData.type = "P"; 106 hybrid(GAData, false); 107 } else { 108 if (!isGTMLoad) {
vendor: 475 bytes, lines 108-118
108 109 (function (w, d, s, l, i) { 110 w[l] = w[l] || []; 111 w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" }); 112 var f = d.getElementsByTagName(s)[0], 113 j = d.createElement(s), 114 dl = l != "dataLayer" ? "&l=" + l : ""; 115 j.async = true; 116 j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl; 117 f.parentNode.insertBefore(j, f); 118 })(window, document, "script", "dataLayer", "
118GTM-PHZ9T8NK
vendor: 12 bytes, lines 118-119
118"); 119
119isGTMLoad = true; 120 } 121 GAData.event = "ga_page"; 122 dataLayer.push(GAData); 123 resetDataLayer(GAData); 124 } 125 } catch (e) { 126 log("sendGAPage ERROR:", e.message); 127 } 128} 129 130function sendGAVirPage(virObject) { 131 if (isIE) return; 132 133 debug('sendGAVirPage', virObject); 134 135 try { 136 virObject = removeEmptyElement(virObject); 137 virCommonData = Object.assign({}, virObject); 138 if (isApp) { 139 virObject.type = "P"; 140 hybrid(virObject, true); 141 } else { 142 virObject.event = "ga_virtual"; 143 dataLayer.push(virObject); 144 resetDataLayer(virObject); 145 } 146 } catch (e) { 147 log("sendVirPage ERROR:", e.message); 148 } 149} 150 151function sendGAEvent(object, isVirtual) { 152 if (isIE) return; 153 if (isApp) { 154 object = replaceToMobileAppEventPage(object, mowebClickEventPrefix, moappClickEventPrefix); 155 } 156 157 debug('sendGAEvent', object); 158 159 try { 160 var GAData = removeEmptyElement(object); 161 if (isApp) { 162 GAData.type = "E"; 163 hybrid(GAData, isVirtual); 164 } else { 165 GAData.event = "ga_event"; 166 if (isVirtual) { 167 GAData = Object.assign({}, virCommonData, GAData); 168 } 169 dataLayer.push(GAData); 170 resetDataLayer(GAData); 171 } 172 } catch (e) { 173 log("sendGAEvent ERROR:", e.message); 174 } 175} 176 177function sendGAAttrEvent(event, isVirtual) { 178 if (isIE) return; 179 180 debug('sendGAAttrEvent', event); 181 182 try { 183 var ELE = event.currentTarget; 184 var ATTR = ELE.attributes; 185 var GAData = {}; 186 for (var i = 0; i < ATTR.length; i++) { 187 if (ATTR[i].name.indexOf("ep_") > -1 || ATTR[i].name.indexOf("cm_") > -1) { 188 GAData[ATTR[i].name] = ATTR[i].value; 189 } 190 } 191 GAData["event_name"] = ELE.getAttribute("event_name"); 192 if (isApp) { 193 GAData.type = "E"; 194 hybrid(GAData, isVirtual); 195 } else { 196 GAData.event = "ga_event"; 197 if (isVirtual) { 198 GAData = Object.assign({}, virCommonData, GAData); 199 } 200 dataLayer.push(GAData); 201 resetDataLayer(GAData); 202 } 203 } catch (e) { 204 log("sendGAAttrEvent ERROR:", e.message); 205 } 206} 207 208function sendGAEcommerce(eventData, transaction, items, isVirtual) { 209 if (isIE) return; 210 211 debug('sendGAEcommerce', eventData); 212 debug('sendGAEcommerce', transaction); 213 debug('sendGAEcommerce', items); 214 215 try { 216 eventData = removeEmptyElement(eventData); 217 transaction = removeEmptyElement(transaction); 218 for (var i in items) { 219 if (items.hasOwnProperty(i)) { 220 items[i] = removeEmptyElement(items[i]); 221 } 222 } 223 if (isApp) { 224 var GAData = Object.assign({}, eventData, { 225 transaction: transaction, 226 items: items, 227 type: "E" 228 }); 229 hybrid(GAData, isVirtual); 230 } else { 231 var GAData = Object.assign({ 232 event: "ga_ecommerce" 233 }, eventData, { 234 ecommerce: Object.assign({}, transaction, { 235 items: items 236 }) 237 }); 238 if (isVirtual) { 239 GAData = Object.assign({}, virCommonData, GAData); 240 } 241 dataLayer.push(GAData); 242 resetDataLayer(GAData); 243 } 244 } catch (e) { 245 log("sendGAEcommerce ERROR:", e.message); 246 } 247} 248 249function log(message) { 250 if (isLogging) { 251 console.log(message); 252 } 253} 254 255function debug(label, object) { 256 if (isLogging) { 257 console.log(label, ">>>>", JSON.stringify(object, null, 2)); 258 } 259} 260
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.