1var Reachgoal = { 2 initialize: { 3 AddProduct: {}, 4 RemoveProduct: {}, 5 Order: {}, 6 Ajaxform: {}, 7 }, 8 goal: function (service, service_id, goal_name, goal_category) { 9 switch (service) { 10 case 'metrika': 11 if (typeof ym != 'undefined') { 12 ym(service_id, 'reachGoal', goal_name); 13 } else { 14 window['yaCounter' + service_id].reachGoal(goal_name); 15 } 16 17 break; 18 19 case 'gtag': 20 if (goal_category) { 21 gtag('event', goal_name, {event_category: goal_category}); 22 } else { 23 gtag('event', goal_name); 24 } 25 break; 26 27 case 'gtm': 28 if (goal_category) { 29 dataLayer.push({'event': 'event-to-ga', 'eventCategory' : goal_category, 'eventAction' : goal_name}); 30 } else { 31 dataLayer.push({'event': 'event-to-ga', 'eventAction' : goal_name}); 32 } 33 break; 34 } 35 } 36} 37 38window.onload = function () { 39 if (typeof miniShop2 != 'undefined') { 40 miniShop2.Callbacks.Cart.add.response.success = function() { 41 if (typeof Reachgoal.initialize.AddProduct != 'undefined') { 42 Reachgoal.initialize.AddProduct.forEach(function(item) { 43 Reachgoal.goal(item.service, item.service_id, item.goal_name, item.goal_category); 44 }); 45 } 46 }; 47 48 miniShop2.Callbacks.Cart.remove.response.success = function() { 49 if (typeof Reachgoal.initialize.RemoveProduct != 'undefined') { 50 Reachgoal.initialize.RemoveProduct.forEach(function(item) { 51 Reachgoal.goal(item.service, item.service_id, item.goal_name, item.goal_category); 52 }); 53 } 54 }; 55 56 miniShop2.Callbacks.Order.submit.response.success = function() { 57 if (typeof Reachgoal.initialize.Order != 'undefined') { 58 Reachgoal.initialize.Order.forEach(function(item) { 59 Reachgoal.goal(item.service, item.service_id, item.goal_name, item.goal_category); 60 }); 61 } 62 } 63 } 64 65 $(document).on('af_complete', function(event, response) { 66 if (response.success && typeof Reachgoal.initialize.AjaxForm != 'undefined') { 67 Reachgoal.initialize.AjaxForm.forEach(function(item) { 68 if (response.form.attr('id') == item.form_id) { 69 Reachgoal.goal(item.service, item.service_id, item.goal_name, item.goal_category); 70 } 71 }); 72 } 73 }); 74};
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.