1// BrandScope ì´ê¸°í ë° ë©ìë ì¬ì©ì ìí ëí¼ í¨ì 2(function (window, document, script, BrandScope, firstScript) { 3 // 매ì¶ìì¹ë구 미리보기(freeShipNotify) ì§ì ì í¸ëí¹ ë¹íì±í 4 // - sales_tool_preview=freeShipNotify URL íë¼ë¯¸í°ë¡ í¸ì¶ë ê²½ì°, 미리보기 íìê° ì¤ë°ì´í°ë¡ ì¡íì§ ìëë¡ í¨ 5 // - 모ë BrandScope.* í¸ì¶ì window.BrandScope ê¸ë¡ë²ì ê±°ì¹ë¯ë¡ ì¬ê¸°ì no-opë¡ ì ìíë©´ íì í¸ì¶ ì ì²´ê° ì°¨ë¨ë¨ 6 // - SDK ì¤í¬ë¦½í¸ë ë¡ë© ì체를 ì¤íµí´ì SDKê° window.BrandScope ë©ìë를 ë®ì´ì°ì§ 못íëë¡ í¨ 7 let isSalesToolFreeShipNotifyPreview = false; 8 try { 9 const params = new URLSearchParams(window.location.search); 10 isSalesToolFreeShipNotifyPreview = params.get('sales_tool_preview') === 'freeShipNotify'; 11 } catch (e) { 12 isSalesToolFreeShipNotifyPreview = false; 13 } 14 15 if (isSalesToolFreeShipNotifyPreview) { 16 const noop = () => {}; 17 window.BrandScope = { 18 init: noop, 19 identify: noop, 20 track: noop, 21 getImwebClientInfo: noop, 22 sessionResetByLogout: noop, 23 timeEvent: noop, 24 q: [], 25 }; 26 return; 27 } 28 29 window.BrandScope = window.BrandScope || { 30 init: function () { 31 (window.BrandScope.q = window.BrandScope.q || []) 32 .push(['init'].concat(Array.prototype.slice.call(arguments))) 33 }, 34 identify: function () { 35 (window.BrandScope.q = window.BrandScope.q || []) 36 .push(['identify'].concat(Array.prototype.slice.call(arguments))) 37 }, 38 track: function () { 39 // TEST_SERVER íê²½ììë§ ë¡ê·¸ ì¶ë ¥ 40 if (typeof TEST_SERVER !== 'undefined' && TEST_SERVER) { 41 console.log('[BrandScope] ì´ë²¤í¸ í¸ëí¹(ëí¼): ', arguments[0], arguments[1]); 42 } 43 (window.BrandScope.q = window.BrandScope.q || []) 44 .push(['track'].concat(Array.prototype.slice.call(arguments))) 45 }, 46 getImwebClientInfo: function () { 47 (window.BrandScope.q = window.BrandScope.q || []) 48 .push(['getImwebClientInfo'].concat(Array.prototype.slice.call(arguments))) 49 }, 50 sessionResetByLogout: function () { 51 (window.BrandScope.q = window.BrandScope.q || []) 52 .push(['sessionResetByLogout'].concat(Array.prototype.slice.call(arguments))) 53 }, 54 timeEvent: function () { 55 (window.BrandScope.q = window.BrandScope.q || []) 56 .push(['timeEvent'].concat(Array.prototype.slice.call(arguments))) 57 }, 58 } 59 60 // BrandScope SDK ì¤í¬ë¦½í¸ ë¡ë 61 BrandScope = window.BrandScope 62 // BrandScope ì¤í¬ë¦½í¸ ëì ë¡ë© 63 script = document.createElement('script') 64 script.type = 'module' 65 script.async = true 66 script.src = (typeof TEST_SERVER !== 'undefined' && TEST_SERVER) 67 ? '//cdn-brandscope.imtest.me/bs.umd.js' 68 : '//static.imweb.me/brand-scope/bs.umd.js'; 69 70 // TEST_SERVER íê²½ììë§ SDK track í¨ì ëí 71 if (typeof TEST_SERVER !== 'undefined' && TEST_SERVER) { 72 script.onload = function() { 73 if (window.BrandScope && typeof window.BrandScope.track === 'function') { 74 var originalTrack = window.BrandScope.track; 75 window.BrandScope.track = function() { 76 console.log('[BrandScope] ì´ë²¤í¸ í¸ëí¹: ', arguments[0], arguments[1]); 77 return originalTrack.apply(this, arguments); 78 }; 79 } 80 }; 81 } 82 83 // BrandScope ì¤í¬ë¦½í¸ ì½ì 84 firstScript = document.getElementsByTagName('script')[0] 85 firstScript.parentNode.insertBefore(script, firstScript) 86})(window, document); 87 88 89 90// data-bs-event ìì±ì ê°ì§ ììë¤ì í´ë¦ í¸ëí¹ ì¶ê° (ë 립 ì¤í) 91(function initBrandScopeClickTracking() { 92 if (document.readyState === 'loading') { 93 document.addEventListener('DOMContentLoaded', initBrandScopeClickTracking); 94 return; 95 } 96 97 98 // 기존 ììë¤ì í¸ëí¹ ì¶ê° 99 function addTrackingToElements() { 100 const elements = document.querySelectorAll('[data-bs-action="click"][data-bs-content]'); 101 102 elements.forEach(function(element) { 103 // ì´ë¯¸ í¸ëí¹ì´ ì¶ê°ë ììë ì¤íµ 104 if (element.hasAttribute('data-bs-tracked')) return; 105 106 const action = element.getAttribute('data-bs-action'); 107 const content = element.getAttribute('data-bs-content'); 108 109 // actionê³¼ contentë íì 110 if (!action || !content) return; 111 112 // click ì¡ì ë§ ì²ë¦¬ 113 if (action !== 'click') return; 114 115 116 element.setAttribute('data-bs-tracked', 'true'); 117 118 element.addEventListener('click', function(event) { 119 try { 120 // ì´ë²¤í¸ëª ìì±: action_target_content_where (ì¡´ì¬íë ê²ë§) 121 const eventParts = [action]; 122 const trackingData = { action: action, content: content }; 123 124 const target = element.getAttribute('data-bs-target'); 125 const where = element.getAttribute('data-bs-where'); 126 127 if (target) { 128 eventParts.push(target); 129 trackingData.target = target; 130 } 131 132 eventParts.push(content); 133 134 if (where) { 135 eventParts.push(where); 136 trackingData.where = where; 137 } 138 139 const eventName = eventParts.join('_'); 140 141 // data-bs-ë¡ ììíë ë¤ë¥¸ ìì±ë¤ì snake_caseë¡ ë³ííì¬ ì¶ê° 142 const excludeAttrs = ['data-bs-action', 'data-bs-target', 'data-bs-content', 'data-bs-where', 'data-bs-tracked'];
143 Array.from(element.attributes).forEach(function(attr) { 144 if (attr.name.startsWith('data-bs-') && !excludeAttrs.includes(attr.name)) { 145 // data-bs- ì ëì¬ ì ê±°íê³ ì¼ë°¥ì¼ì´ì¤ë¥¼ ì¤ë¤ì´í¬ì¼ì´ì¤ë¡ ë³í 146 const key = attr.name.replace('data-bs-', '').replace(/-/g, '_'); 147 let value = attr.value; 148 149 // data-bs-is-ë¡ ììíë ìì±ì ê²½ì° boolean ë³í 150 if (attr.name.startsWith('data-bs-is-')) { 151 if (value === 'true') { 152 value = true; 153 } else if (value === 'false') { 154 value = false; 155 } 156 } 157 158 trackingData[key] = value; 159 } 160 }); 161 162 163 if (typeof BrandScope !== "undefined") { 164 BrandScope.track(eventName, trackingData); 165 } 166 } catch (error) { 167 // í¸ëí¹ ì¤ë¥ 무ì 168 } 169 }); 170 }); 171 172 } 173 174 // ì´ê¸° ììë¤ì í¸ëí¹ ì¶ê° 175 addTrackingToElements(); 176 177 // ëì ì¼ë¡ ì¶ê°ëë ììë¤ì ìí MutationObserver 178 if (typeof MutationObserver !== 'undefined') { 179 const observer = new MutationObserver(function(mutations) { 180 181 let hasNewElements = false; 182 mutations.forEach(function(mutation) { 183 if (mutation.type === 'childList') { 184 mutation.addedNodes.forEach(function(node) { 185 if (node.nodeType === Node.ELEMENT_NODE) { 186 // ì¶ê°ë ë ¸ë ìì²´ê° data-bs-action="click"ê³¼ data-bs-content를 ê°ì§ê±°ë, íìì ê°ì§ ê²½ì° 187 if (node.hasAttribute && node.getAttribute('data-bs-action') === 'click' && node.hasAttribute('data-bs-content')) { 188 hasNewElements = true; 189 } else if (node.querySelector && node.querySelector('[data-bs-action="click"][data-bs-content]')) { 190 hasNewElements = true; 191 } 192 } 193 }); 194 } 195 }); 196 197 198 if (hasNewElements) { 199 addTrackingToElements(); 200 } 201 }); 202 203 observer.observe(document.body, { 204 childList: true, 205 subtree: true 206 }); 207 208 } 209})(); 210 211(function initBrandScope() { 212 if (document.readyState === 'loading') { 213 document.addEventListener('DOMContentLoaded', initBrandScope); 214 return; 215 } 216 217 // ìí ìì¸ ìì ¯ì´ ìì ê²½ì° ìì ¯ìì ìí ë°ì´í°ì í¨ê» ì´ê¸°í 218 const hasShopViewWidget = !!document.querySelector('[data-widget-type="shop_view"]'); 219 if (hasShopViewWidget) { 220 return; 221 } 222 223 BrandScope.init({ 224 projectToken: 'bs-im-019d09ae-1518-75f7-8c4f-33cf513a7a8a', 225 props: { 226 ownership: 'behavior-tracking-analytics', 227 } 228 }); 229})();
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.