1window.ymCCount = window.ymCCount || 0; 2 3function agec_init_ordersteps(items){ 4 // console.log('agec_init_ordersteps', items); 5 6 var deliveryInputs = document.querySelectorAll("[name=DELIVERY_ID]"); 7 if(deliveryInputs.length){ 8 deliveryInputs.forEach(function(item){ 9 var clickItem = item.parentElement; 10 if(!clickItem.classList.contains('agec_init')){ 11 clickItem.classList.add('agec_init'); 12 13 BX.bind(clickItem, "click", function(){ 14 var deliveryID = this.querySelector('input').value; 15 BX.ajax({ 16 url: '/bitrix/tools/arturgolubev.ecommerce/ajax.php', 17 data: {'action': 'get_delivery_name', 'deliveryID': deliveryID}, 18 19 method: 'POST', 20 dataType: "json", 21 22 async: true, processData: true, scriptsRunFirst: false, emulateOnload: false, start: true, cache: false, 23 24 onsuccess: function(data){ 25 // console.log("AGEC send delivery change", data.delivery_name); 26 var agec_add_shipping_info = {"shipping_tier": data.delivery_name, "items": items}; 27 gtag("event", "add_shipping_info", agec_add_shipping_info); 28 }, 29 onfailure: function(){ 30 console.log('arturgolubev.ecommerce Request Error'); 31 }, 32 }); 33 }); 34 } 35 }); 36 } 37 38 // payment 39 var paymentInputs = document.querySelectorAll("[name=PAY_SYSTEM_ID]"); 40 if(paymentInputs.length){ 41 paymentInputs.forEach(function(item){ 42 var clickItem = item.parentElement; 43 if(!clickItem.classList.contains('agec_init')){ 44 clickItem.classList.add('agec_init'); 45 46 BX.bind(clickItem, "click", function(){ 47 var paymentID = this.querySelector('input').value; 48 49 BX.ajax({ 50 url: '/bitrix/tools/arturgolubev.ecommerce/ajax.php', 51 data: {'action': 'get_payment_name', 'paymentID': paymentID}, 52 53 method: 'POST', 54 dataType: "json", 55 56 async: true, processData: true, scriptsRunFirst: false, emulateOnload: false, start: true, cache: false, 57 58 onsuccess: function(data){ 59 // console.log("AGEC send payment change", data.payment_name); 60 var agec_add_payment_info = {"payment_type": data.payment_name, "items": items}; 61 gtag("event", "add_payment_info", agec_add_payment_info); 62 }, 63 onfailure: function(){ 64 console.log('arturgolubev.ecommerce Request Error'); 65 }, 66 }); 67 }); 68 } 69 }); 70 } 71} 72 73function ymChecker(callback, obj){ 74 if(obj == 'ym') 75 var work = (typeof ym == "undefined"); 76 else 77 var work = (typeof Ya == "undefined"); 78 79 if(work){ 80 window.ymCCount = window.ymCCount + 1; 81 if(window.ymCCount <= 30){ 82 setTimeout(function(){ 83 ymChecker(callback, obj); 84 }, 500); 85 } 86 }else{ 87 callback(); 88 } 89} 90 91function agec_ym_goal(counter, goal, debug){ 92 counter = parseInt(counter); 93 if(counter){ 94 ymChecker(function(){ 95 ym(counter, "reachGoal", goal); 96 97 if(debug){ 98 console.log('EC debug: ym send goal '+goal); 99 } 100 }, 'ym'); 101 }else{ 102 ymChecker(function(){ 103 Ya._metrika.getCounters().forEach(function(el){ 104 ym(el.id, "reachGoal", goal); 105 106 if(debug){ 107 console.log('EC debug: ya send goal '+goal); 108 } 109 }); 110 }, 'ya'); 111 } 112}
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.