1jQuery(($) => { 2 const product = productData 3 let productPrice = parseFloat( 4 parseFloat(product.item_price).toFixed(product.siteData.price_decimal) 5 ) 6 const quantity = $(product.siteData.quantity_selector).val() 7 8 let variantId = '' 9 if (product.variation) { 10 // Get selected variation ID 11 variantId = 12 product.default_variation_id || Object.keys(product.variation_prices)?.[0] 13 productPrice = parseFloat(product.variation_prices[variantId]) 14 } 15 16 const total = parseFloat( 17 parseFloat(quantity * productPrice).toFixed(product.siteData.price_decimal) 18 ) 19 20 const content = { 21 id: product.id.toString(), 22 quantity: parseInt(quantity), 23 item_price: productPrice, 24 title: product.title, 25 category: product.category, 26 image: product.image, 27 url: product.url, 28 } 29 30 if (variantId) { 31 content.variantId = variantId 32 } 33 34 if (product.sku) { 35 content.sku = product.sku 36 } 37 38 edgetag('tag', 'ViewContent', { 39 contents: [content], 40 currency: product.siteData.currency, 41 value: total, 42 }) 43})
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.