1function event_cart(event, productData, quantity = 1) { 2 dataLayer.push({ ecommerce: null }); 3 dataLayer.push({ 4 event: event, 5 ecommerce: { 6 items: [{ 7 item_name: productData['name'], 8 item_id: productData['id'], 9 price: productData['price'], 10 item_brand: productData['brand_name'], 11 item_category: productData['category_name'], 12 quantity: quantity 13 }] 14 } 15 }); 16 console.log(dataLayer); 17} 18 19function purchase(ecommerceData) { 20 let items = []; 21 $.each(ecommerceData['items'], function (key, productData) { 22 let item = { 23 item_name: productData['name'], 24 item_id: productData['id'], 25 price: productData['price'], 26 item_brand: productData['brand_name'], 27 item_category: productData['category_name'], 28 quantity: productData['quantity'], 29 } 30 items.push(item); 31 }); 32 dataLayer.push({ ecommerce: null }); 33 dataLayer.push({ 34 event: "purchase", 35 ecommerce: { 36 transaction_id: ecommerceData['number'], 37 affiliation: ecommerceData['affiliation'], 38 value: ecommerceData['total'], 39 tax: "0", 40 shipping: "0", 41 currency: "UAH", 42 items: items 43 } 44 }); 45 console.log(dataLayer); 46}
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.