1function reportBasketUpdateToOptimove(basketItems, delivery_channel, order_value) { 2 const optimoveProductLimit = 9; 3 const baseURL = window.location.origin; 4 const params = {}; 5 6 const sortedItems = basketItems.sort((a, b) => b.Price - a.Price); // sort by highest price descending 7 8 let index = 0; 9 for (const item of sortedItems) { 10 11 const productIndex = index + 1; 12 params[`product_image_${productIndex}`] = item.ThumbnailImage.includes('https') ? `${item.ThumbnailImage}` : `https://assets.cookfood.net/${item.ThumbnailImage}`; 13 params[`product_name_${productIndex}`] = item.ProductName; 14 params[`product_price_${productIndex}`] = item.Price.toFixed(2); 15 params[`product_url_${productIndex}`] = `${baseURL}/products/${item.ProductURL}`; 16 params[`product_qty_${productIndex}`] = item.Quantity; 17 index++; 18 19 if (index === optimoveProductLimit) { // force to only load 9 20 break; 21 } 22 } 23 24 params['delivery_channel'] = delivery_channel; 25 params['link_to_cart'] = `${baseURL}/basket`; 26 params['order_value'] = order_value; 27 28 console.log('Params for sending to optimove', params); 29 30 if (typeof optimoveSDK !== 'undefined') { 31 optimoveSDK.API.reportEvent('basket_update', params); 32 } 33}
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.