1function googleMarketingTools_Ajax_Events_Setup() { 2 if (typeof $ !== "undefined") { 3 $(document).ajaxSuccess(function (event, xhr, settings, json) { 4 if (settings.url.includes("checkout/cart/add") && !json.error) { 5 // Measuring add to cart 6 if (json['gtm_id']) { 7 var object = googleMarketingTools_FormatJsonCart(json); 8 _GoogleMarketingTools.trackAddToCart(object); 9 } 10 } else if (settings.url.includes("account/wishlist/add") && !json.error) { 11 // Measuring add to wishlist 12 if (json['gtm_id']) { 13 var object = googleMarketingTools_FormatJsonCart(json); 14 _GoogleMarketingTools.trackAddToWishlist(object); 15 } 16 } else if ((settings.url.includes("checkout/cart/remove") || settings.url.includes("extension/d_quickcheckout/cart/update")) && !json.error && typeof json['atc_id'] !== undefined) { 17 // Measuring remove from cart 18 if (json['gtm_id']) { 19 var object = googleMarketingTools_FormatJsonCart(json); 20 _GoogleMarketingTools.trackRemoveFromCart(object); 21 } 22 } 23 }); 24 } else { 25 setTimeout(googleMarketingTools_Ajax_Events_Setup, 250); 26 } 27} 28 29googleMarketingTools_Ajax_Events_Setup(); 30 31function googleMarketingTools_Start(result) { 32 // Send main data to Google Marketing Tools 33 var general_data = { 34 'store_name': result.general_data.store_name, 35 'lang': gmt_language, 36 'current_view': result.general_data.current_view, 37 'current_list': result.general_data.current_list, 38 'current_currency': result.general_data.current_currency, 39 'userId': result.general_data.userId, 40 'clientId': result.general_data.clientId, 41 'gclDc': result.general_data.gclDc, 42 'email': result.general_data.email, 43 'debug_enabled': this.debug_enabled, 44 'event_id': result.general_data.event_id 45 } 46 47 _GoogleMarketingTools.init(general_data); 48 49 if (typeof result.products_listed !== 'undefined') { 50 _GoogleMarketingTools.setProducts(result.products_listed); 51 } 52 53 if (typeof result.promotions_listed !== 'undefined') { 54 _GoogleMarketingTools.trackPromotionsListed(result.promotions_listed); 55 } 56 57 if (typeof result.fb_api_track_info !== 'undefined') { 58 _GoogleMarketingTools.setFacebookApiTrack(result.fb_api_track_info); 59 } 60 61 if (typeof result.general_data.cart_products !== 'undefined') { 62 _GoogleMarketingTools.setCartProducts(result.general_data.cart_products); 63 } 64 65 if (typeof result.product_details !== 'undefined') { 66 _GoogleMarketingTools.trackProductPage(result.product_details); 67 } 68 69 if ( 70 result.general_data.current_view == 'search' && 71 typeof result.general_data.string_searched !== 'undefined' && 72 typeof result.products_listed !== 'undefined' && 73 typeof result.products_listed) { 74 _GoogleMarketingTools.trackSearchPage(result.general_data.string_searched); 75 } 76 77 if (result.general_data.current_view == 'category') { 78 _GoogleMarketingTools.trackCategoryPage(result.general_data.current_categories); 79 } 80 81 if (result.general_data.current_view == 'homepage') { 82 _GoogleMarketingTools.trackHomePage(); 83 } 84 85 if (result.general_data.current_view == 'cart') { 86 _GoogleMarketingTools.trackCartPage(); 87 } 88 89 if (result.general_data.current_view == 'account_success') { 90 _GoogleMarketingTools.trackAccountRegistered(); 91 } 92 93 if (result.general_data.current_view == 'checkout') { 94 _GoogleMarketingTools.trackCheckoutPage(); 95 } 96 97 if (typeof result.order_data !== 'undefined') { 98 _GoogleMarketingTools.trackPurchase(result.order_data); 99 } 100} 101 102function googleMarketingTools_FormatJsonCart(json) { 103 var object_formatted = {}; 104 105 object_formatted.id = typeof json['gtm_id'] != 'undefined' ? json['gtm_id'] : ''; 106 object_formatted.id_ee = typeof json['gtm_id_ee'] != 'undefined' ? json['gtm_id_ee'] : ''; 107 object_formatted.id_gdr_1 = typeof json['gtm_id_gdr_1'] != 'undefined' ? json['gtm_id_gdr_1'] : ''; 108 object_formatted.id_gdr_2 = typeof json['gtm_id_gdr_2'] != 'undefined' ? json['gtm_id_gdr_2'] : ''; 109 object_formatted.id_fb = typeof json['gtm_id_fb'] != 'undefined' ? json['gtm_id_fb'] : ''; 110 object_formatted.price = typeof json['gtm_price'] != 'undefined' ? json['gtm_price'] : ''; 111 object_formatted.price_eur = typeof json['gtm_price_eur'] != 'undefined' ? json['gtm_price_eur'] : ''; 112 object_formatted.name = typeof json['gtm_name'] != 'undefined' ? json['gtm_name'] : ''; 113 object_formatted.category = typeof json['gtm_category'] != 'undefined' ? json['gtm_category'] : ''; 114 object_formatted.brand = typeof json['gtm_brand'] != 'undefined' ? json['gtm_brand'] : ''; 115 object_formatted.quantity = typeof json['gtm_quantity'] != 'undefined' ? json['gtm_quantity'] : 1; 116 object_formatted.variant = typeof json['gtm_variant'] != '' ? json['gtm_variant'] : ''; 117 object_formatted.image_url = typeof json['gtm_image'] != '' ? json['gtm_image'] : ''; 118 object_formatted.url = typeof json['url'] != '' ? json['url'] : ''; 119 object_formatted.sku = typeof json['gtm_sku'] != '' ? json['gtm_sku'] : ''; 120 object_formatted.fb_event_id = typeof json['fb_event_id'] != '' ? json['fb_event_id'] : ''; 121 122 return object_formatted; 123} 124 125function gmt_rand(min, max) { 126 if (min == 0) { 127 return Math.floor((Math.random() * max) + 0); 128 } else { 129 return Math.floor(Math.random() * (max - min + 1)) + min; 130 } 131} 132 133function removeFromCart_OC15(product_id_key, quantity) { 134 $.ajax({ 135 url: 'index.php?route=extension/module/google_all/get_product_datas', 136 data: { product_id_key: product_id_key, quantity: quantity }, 137 type: "POST", 138 dataType: 'json', 139 beforeSend: function () { 140 }, 141 success: function (data) { 142 if (data) { 143 eventDataLayerRemoveFromCart(data.atc_id, data.atc_price, data.atc_name, data.atc_category, data.atc_brand, data.atc_quantity, data.atc_variant); 144 } 145 }, 146 error: function (data) { 147 }, 148 }); 149} 150 151document.addEventListener('DOMContentLoaded', function () { 152 document.querySelectorAll('a[href="#GMTCookiesSettings"]').forEach(function(link) { 153 link.addEventListener('click', function(event) { 154 event.preventDefault(); // Previene la acción por defecto del enlace 155 _GoogleMarketingTools.googleConsentOpenConsentPopup(); 156 }); 157 }); 158});
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.