1document.addEventListener("DOMContentLoaded", function(){ 2 3 function PinterestPixelSetDelay(ms) { 4 var cur_d = new Date(); 5 var cur_ticks = cur_d.getTime(); 6 var ms_passed = 0; 7 while(ms_passed < ms) { 8 var d = new Date(); 9 var ticks = d.getTime(); 10 ms_passed = ticks - cur_ticks; 11 } 12 } 13 14 prestashop.on('updateCart', function(params) { 15 16 if (typeof(params) !== 'undefined' && typeof(prestashop.cart) !== 'undefined') { 17 var iso_code = prestashop.currency.iso_code, 18 product_id = params.reason.idProduct, 19 product_id_product_attribute = params.reason.idProductAttribute, 20 pinterestPixelValues; 21 22 $.ajax({ 23 type: "POST", 24 headers: {"cache-control": "no-cache"}, 25 url: pdpinterestpixeltracking_ajax_link, 26 data: {'action': 'updateCart', 'product_id': product_id, 'product_id_product_attribute' : product_id_product_attribute, 'secure_key': pdpinterestpixeltracking_secure_key, ajax : true}, 27 dataType: "json", 28 cache: false, 29 success: function(data) { 30 console.log('Pinterest Pixel - Event AddToCart'); 31 pinterestPixelValues = { 32 value: data.product_price, 33 order_quantity: data.product_quantity, 34 currency: iso_code, 35 line_items: [{ 36 product_category: data.product_category, 37 product_name: data.product_name, 38 product_id: data.product_id, 39 product_price: data.product_price, 40 product_quantity: data.product_quantity, 41 product_variant_id: data.product_variant_id, 42 product_variant: data.product_variant, 43 product_brand: data.product_brand 44 }] 45 }; 46 pintrk('track', 'addtocart', pinterestPixelValues); 47 } 48 }); 49 } 50 }); 51 52 prestashop.on('updateProduct', function(params) { 53 54 if (typeof(params) !== 'undefined') { 55 var iso_code = prestashop.currency.iso_code, 56 product_id = parseInt(document.getElementsByName('id_product')[0].value), 57 groups = [], 58 select_groups = document.getElementsByClassName('form-control-select'), 59 input_color_group = document.getElementsByClassName('input-color'), 60 input_radio_group = document.querySelector('.input-radio:checked'), 61 pinterestPixelValues; 62 63 if (typeof(select_groups) != 'undefined' && select_groups != null) { 64 for (select_count = 0; select_count < select_groups.length; select_count++) { 65 groups.push(select_groups[select_count].value); 66 } 67 } 68 69 if (typeof(input_color_group) != 'undefined' && input_color_group != null) { 70 for (color_count = 0; color_count < input_color_group.length; color_count++) { 71 if (input_color_group[color_count].checked) { 72 groups.push(input_color_group[color_count].value); 73 } 74 } 75 } 76 77 if (typeof(input_radio_group) != 'undefined' && input_radio_group != null) { 78 for (radio_count = 0; radio_count < input_radio_group.length; radio_count++) { 79 if (input_radio_group[radio_count].checked) { 80 groups.push(input_radio_group[radio_count].value); 81 } 82 } 83 } 84 85 $.ajax({ 86 type: "POST", 87 headers: {"cache-control": "no-cache"}, 88 url: pdpinterestpixeltracking_ajax_link, 89 data: {'action': 'updateProduct', 'product_id': product_id, 'attributes_groups': groups,'secure_key': pdpinterestpixeltracking_secure_key, ajax : true}, 90 dataType: "json", 91 cache: false, 92 success: function(data) { 93 console.log('Pinterest Pixel - Event PageVisit on combination change'); 94 pinterestPixelValues = { 95 value: data.product_price, 96 order_quantity: data.product_quantity, 97 currency: iso_code, 98 line_items: [{ 99 product_category: data.product_category, 100 product_name: data.product_name, 101 product_id: data.product_id, 102 product_price: data.product_price, 103 product_quantity: data.product_quantity, 104 product_variant_id: data.product_variant_id, 105 product_variant: data.product_variant, 106 product_brand: data.product_brand 107 }] 108 }; 109 pintrk('track', 'pagevisit', pinterestPixelValues); 110 } 111 }); 112 } 113 }); 114});
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.