1import { createImdog } from 'https://static.imweb.me/design-system/imdog/imdog.js'; 2 3var sessionSampleRate = (typeof SITE_CODE !== 'undefined' && typeof SESSION_SAMPLE_RATE !== 'undefined') ? SESSION_SAMPLE_RATE : 0; 4 5if (typeof IS_B2B_SITE !== 'undefined' && IS_B2B_SITE) { 6 sessionSampleRate = 0; 7} 8 9var imdog = createImdog(); 10imdog.init({ 11 applicationId: 'bcdd1a85-8a90-4c8c-8594-8a3f35984f6e', 12 clientToken: 'pub4b0d7410f941f04271a5ef090eb48d87', 13 service: 'brand-site', 14 env: typeof TEST_SERVER !== 'undefined' && !TEST_SERVER ? 'prod' : 'dev', 15 version: '260131', 16 sessionSampleRate: sessionSampleRate, 17 sessionReplaySampleRate: 0, 18 customConfig : { 19 strategy: { 20 type: 'action-threshold', 21 actionThreshold: 10, 22 }, 23 receiver: { transport: 'auto' }, 24 domInteraction: { trackClicks: true }, 25 debug: false, 26 }, 27 beforeSend: function(event) { 28 event.context = event.context || {}; 29 if (event.type === 'view' && event.view && event.view.time_spent >= 10000000000) { 30 event.context.session_retained_10s = true; 31 } 32 if (event.type === 'resource') { 33 var resource = event.resource; 34 if (resource && (resource.type === 'fetch' || resource.type === 'xhr')) { 35 return event; 36 } 37 if (resource && resource.url && resource.url.indexOf('/_/') !== -1) { 38 return event; 39 } 40 return null; 41 } 42 return event; 43 }, 44}); 45 46if (typeof SITE_CODE !== 'undefined') { 47 imdog.setAccount({ 48 id: SITE_CODE, 49 ...(typeof UNIT_CODE !== 'undefined' && { unit_code: UNIT_CODE }), 50 ...(typeof USE_SHOP_IN_SHOP !== 'undefined' && { use_shop_in_shop: USE_SHOP_IN_SHOP }), 51 ...(typeof VIEWER_COUNTRY !== 'undefined' && VIEWER_COUNTRY && { viewer_country: VIEWER_COUNTRY }), 52 }); 53} 54 55imdog.setUser({ 56 ...(typeof MEMBER_HASH !== 'undefined' && MEMBER_HASH && { id: MEMBER_HASH }), 57 ...(typeof IS_GUEST !== 'undefined' && { is_guest: IS_GUEST }), 58}); 59 60(function() { 61 if (typeof jQuery === 'undefined') return; 62 63 jQuery(document).ajaxError(function(event, xhr, settings) { 64 var errorType = xhr.status === 504 ? 'gateway_timeout' : 'ajax_http_error'; 65 imdog.addError(new Error('AJAX ìì² ì¤í¨: ' + xhr.status + ' ' + (xhr.statusText || '')), { 66 source: 'custom', 67 type: errorType, 68 http_status: xhr.status, 69 url: settings.url 70 }); 71 }); 72 73 jQuery(document).ajaxSuccess(function(event, xhr, settings) { 74 if (settings.dataType !== 'json') return; 75 var httpStatus = xhr.status; 76 if (httpStatus >= 400) { 77 var errorType = httpStatus === 504 ? 'gateway_timeout' : 'ajax_http_error'; 78 imdog.addError(new Error('AJAX ìì² ì¤í¨: ' + httpStatus + ' ' + (xhr.statusText || '')), { 79 source: 'custom', 80 type: errorType, 81 http_status: httpStatus, 82 url: settings.url 83 }); 84 return; 85 } 86 try { 87 var res = typeof xhr.responseJSON !== 'undefined' ? xhr.responseJSON : JSON.parse(xhr.responseText); 88 if (!res || res.msg === 'SUCCESS') return; 89 imdog.addError(new Error('AJAX ë¹ì¦ëì¤ ìë¬: ' + res.msg), { 90 source: 'custom', 91 type: 'ajax_business_error', 92 error_code: res.code, 93 url: settings.url 94 }); 95 } catch (e) { 96 } 97 }); 98})();
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.