1var FB_PIXEL = function(){ 2 var order_info = []; 3 var ViewContent = function(id,name,value,currency){ /* 컨í ì¸ ì¡°í */ 4 if(typeof fbq != 'undefined'){ 5 fbq('track', 'ViewContent', { 6 content_type : 'product', 7 content_ids : id, 8 content_name : name, 9 contents : [{"id": id, "quantity": 1, "item_price": value}], 10 value : parseInt(value).toFixed(2), 11 currency : currency 12 }); 13 } 14 }; 15 var AddOrderInfo = function(idx,ea,price){ 16 order_info.push({ 17 'id' : idx, 18 'quantity' : ea, 19 'item_price' : price, 20 'type' : 'product' 21 }); 22 }; 23 24 var AddToCart = function(id, name, price,currency,count,total_price,event_id,fb_external_id){ /* ì¥ë°êµ¬ë ì¶ê° */ 25 if (typeof fbq != 'undefined') fbq('track', 'AddToCart',{ 26 content_ids : id, 27 content_type : 'product', 28 content_name : name, 29 contents : [{"id": id, "quantity": count, "item_price": price}], 30 value : parseInt(price).toFixed(2), 31 currency : currency 32 },{eventID : event_id}); 33 }; 34 var AddToWishlist = function(){ /* ìì리ì¤í¸ ì¶ê° */ 35 //console.log("FB_PIXEL - AddToWishlist"); 36 if (typeof fbq != 'undefined') fbq('track', 'AddToWishlist'); 37 }; 38 var InitiateCheckout = function(event_id,total_price,currency,fb_external_id){ /* ê²°ì ìì */ 39 if (typeof fbq != 'undefined') { 40 //console.log("FB_PIXEL - InitiateCheckout"); 41 if (typeof fbq != 'undefined') fbq('track', 'InitiateCheckout', { 42 value: parseInt(total_price).toFixed(2), 43 currency: currency 44 }, {eventID: event_id}); 45 } 46 }; 47 var AddPaymentInfo = function(){ /* ê²°ì ì ë³´ ì¶ê° */ 48 //console.log("FB_PIXEL - AddPaymentInfo"); 49 if (typeof fbq != 'undefined') fbq('track', 'AddPaymentInfo'); 50 }; 51 var Purchase = function(value,currency,flag_code,fb_external_id){ 52 /* ê²°ì ìë£ */ 53 var dispatchPurchase = function() { 54 var content_ids = []; 55 /* content_ids ì¤ì - order_info ìì idë§ ë½ìì ìì±í´ì¤ë¤. */ 56 order_info.forEach(function(obj) { 57 if (content_ids.indexOf(obj.id) == -1) content_ids.push(obj.id); 58 }); 59 60 console.log("dispatchPurchaseFree : ", value, ", ", currency); 61 // valueê° ì«ìì´ê³ currencyê° ì¡´ì¬í ëë§ track 62 if (!isNaN(parseFloat(value)) && currency) { 63 console.log("dispatchPurchaseTrack : ", value, ", ", currency); 64 // Purchase ì´ë²¤í¸ ì ì¡ 65 fbq('track', 'Purchase', { 66 content_ids: content_ids, 67 content_type: 'product', 68 contents: order_info, 69 value: parseFloat(value), 70 currency: currency 71 }, { eventID: flag_code }); 72 } 73 }; 74 75 // fbqê° ì´ë¯¸ ë¡ëëì´ ìì¼ë©´ ì¦ì ì ì¡ 76 if (typeof fbq !== 'undefined') { 77 dispatchPurchase(); 78 return; 79 } 80 81 // window.fbq í ë¹ ê°ì§ë¥¼ ìí descriptor ì¬ì© 82 var originalFbq = window.fbq; 83 var fbqDetected = false; 84 85 try { 86 // Object.defineProperty를 ì¬ì©í´ì fbq í ë¹ ê°ì§ 87 Object.defineProperty(window, 'fbq', { 88 get: function() { 89 return originalFbq; 90 }, 91 set: function(value) { 92 originalFbq = value; 93 if (!fbqDetected && typeof value === 'function') { 94 fbqDetected = true; 95 setTimeout(function() { 96 dispatchPurchase(); 97 }, 0); 98 } 99 }, 100 configurable: true 101 }); 102 } catch(e) { 103 // definePropertyê° ì¤í¨íë ê²½ì° (IE8 ë±) í´ë°± 104 var checkFbq = function() { 105 if (typeof window.fbq !== 'undefined' && !fbqDetected) { 106 fbqDetected = true; 107 dispatchPurchase(); 108 } else if (!fbqDetected) { 109 setTimeout(checkFbq, 100); 110 } 111 }; 112 setTimeout(checkFbq, 100); 113 } 114 115 // 10ì´ íìììì¼ë¡ ê°ì ì 리 116 setTimeout(function() { 117 fbqDetected = true; // ë ì´ì ê°ì§íì§ ìì 118 }, 10000); 119 }; 120 var CompleteRegistration = function(type,currency,id){ 121 if(type == 'join'){ 122 if (typeof fbq != 'undefined') fbq('track', 'CompleteRegistration',{'id' : id , 'value' : 0, 'currency' : currency}); 123 }else{ 124 if (typeof fbq != 'undefined') fbq('track', 'CompleteRegistration',{'value' : 0, 'currency' : currency}); 125 } 126 }; 127 128 129 var use_npay_count = false; 130 var setUseNpayCount = function(b){ 131 use_npay_count = (b === true); 132 }; 133 var addNpayOrder = function(order_data){ 134 if(!use_npay_count) return false;
135 if( typeof order_data == 'undefined') return false; 136 if( typeof order_data['list'] == 'undefined') return false; 137 // ë¤ì´ë² íì´ë 구매ì íì í¬í¨íê²ë ìµì ì ì¬ì©í ê²½ì°ìë 구매ìë£ë¥¼ ë°ë¡ ë³´ë¸ë¤ 138 139 var np_fb_data = {'total_price': 0, 'currency': order_data['currency']}; 140 var npay_order_item = {}; 141 for(var i = 0; i<order_data['list'].length; i++){ 142 npay_order_item = order_data['list'][i]; 143 AddOrderInfo(npay_order_item['prod_idx'], npay_order_item['count'], npay_order_item['price']); 144 } 145 np_fb_data['total_price'] = order_data['total_price']; 146 np_fb_data['pc_event_id'] = order_data['pc_event_id']; 147 np_fb_data['fb_external_id'] = order_data['fb_external_id']; 148 149 Purchase(np_fb_data['total_price'], np_fb_data['currency'], np_fb_data['pc_event_id'],np_fb_data['fb_external_id']); 150 }; 151 return { 152 "ViewContent" : function(id,name,value,currency){ 153 ViewContent(id,name,value,currency); 154 }, 155 "AddToCart" : function(id, name, price,currency,count,total_price,event_id,fb_external_id){ 156 AddToCart(id, name, price,currency,count,total_price,event_id,fb_external_id); 157 }, 158 "AddOrderInfo" : function(idx,ea,price){ 159 AddOrderInfo(idx,ea,price); 160 }, 161 "AddToWishlist" : function(){ 162 AddToWishlist(); 163 }, 164 "InitiateCheckout" : function(event_id,total_price,currency,fb_external_id){ 165 InitiateCheckout(event_id,total_price,currency,fb_external_id); 166 }, 167 "AddPaymentInfo" : function(){ 168 AddPaymentInfo(); 169 }, 170 "Purchase" : function(value,currency,order_no,fb_external_id){ 171 Purchase(value,currency,order_no,fb_external_id); 172 }, 173 "CompleteRegistration" : function(type,currency,id){ 174 CompleteRegistration(type,currency,id); 175 }, 176 "setUseNpayCount": function(b){ 177 setUseNpayCount(b); 178 }, 179 "addNpayOrder" : function(order_data){ 180 addNpayOrder(order_data); 181 } 182 } 183}();
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.