PageSourceSearch

https://www.adhaus.co.kr/js/fb_pixel.js?1791338889

js adhaus.co.kr collected 2026-10-08 00:02:27 UTC 9,986 bytes, 243 lines download raw bytes

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	// 전용 API의 존재가 dry-run 지원 계약이다. 기존 8인자 송신 API와 분리한다.
35	var AddToCartDryRun = function(id, name, price, currency, count, total_price, event_id, fb_external_id, compatibility){
36		var valid = compatibility !== null && typeof compatibility === 'object' && !Array.isArray(compatibility)
37			&& Object.keys(compatibility).sort().join(',') === 'compatibility_target,event_name,mode,projection'
38			&& compatibility.mode === 'dry_run' && compatibility.event_name === 'AddToCart'
39			&& typeof compatibility.compatibility_target === 'boolean';
40		var projection = valid ? compatibility.projection : null;
41		if (valid && projection !== null) {
42			valid = compatibility.compatibility_target === true
43				&& typeof projection === 'object' && !Array.isArray(projection)
44				&& Object.keys(projection).sort().join(',') === 'pixel_id,product_id'
45				&& typeof projection.pixel_id === 'string' && projection.pixel_id.length >= 1 && projection.pixel_id.length <= 100 && !/[^0-9]/.test(projection.pixel_id)
46				&& typeof projection.product_id === 'string';
47		}
48		var applied = valid && projection !== null;
49		var product_id = applied ? projection.product_id : id;
50		// 응답 원문과 개인 식별자는 기록하지 않는다. 관측 실패도 송신으로 재시도하지 않는다.
51		try {
52			if (typeof console !== 'undefined' && typeof console.info === 'function') {
53				console.info('[FS-3585][META_EVENT_DRY_RUN]', {
54					feature_key: 'FS-3585', mode: 'dry_run', provider: 'meta', event_name: 'AddToCart',
55					disposition: !valid ? 'invalid_response' : (applied ? 'projection_applied' : 'projection_absent'),
56					compatibility_applied: applied,
57					pixel_override: applied, pixel_id: applied ? projection.pixel_id : null,
58					payload: {
59						content_ids: product_id, content_type: 'product', content_name: name,
60						contents: [{id: product_id, quantity: count, item_price: price}],
61						value: parseInt(price).toFixed(2), currency: currency
62					},
63					options: {eventID: event_id}
64				});
65			}
66		} catch (e) { /* 관측 실패는 장바구니 성공에 영향을 주지 않는다. */ }
67	};
68	var AddToWishlist = function(){	/* 위시리스트 추가 */
69		//console.log("FB_PIXEL - AddToWishlist");
70		if (typeof fbq != 'undefined') fbq('track', 'AddToWishlist');
71	};
72	var InitiateCheckout = function(event_id,total_price,currency,fb_external_id){	/* 결제시작 */
73		if (typeof fbq != 'undefined') {
74			//console.log("FB_PIXEL - InitiateCheckout");
75			if (typeof fbq != 'undefined') fbq('track', 'InitiateCheckout', {
76				value: parseInt(total_price).toFixed(2),
77				currency: currency
78			}, {eventID: event_id});
79		}
80	};
81	// 기존 Checkout 4인자 API와 분리된 관측 전용 경계. SDK를 초기화하거나 호출하지 않는다.
82	var InitiateCheckoutDryRun = function(event_id, total_price, currency, fb_external_id, compatibility){
83		var valid = compatibility !== null && typeof compatibility === 'object' && !Array.isArray(compatibility)
84			&& Object.keys(compatibility).sort().join(',') === 'compatibility_target,event_name,mode,projection'
85			&& compatibility.mode === 'dry_run' && compatibility.event_name === 'InitiateCheckout'
86			&& typeof compatibility.compatibility_target === 'boolean';
87		var projection = valid ? compatibility.projection : null;
88		if (valid && projection !== null) {
89			valid = compatibility.compatibility_target === true && typeof projection === 'object' && !Array.isArray(projection)
90				&& Object.keys(projection).join(',') === 'pixel_id' && typeof projection.pixel_id === 'string'
91				&& projection.pixel_id.length >= 1 && projection.pixel_id.length <= 100 && !/[^0-9]/.test(projection.pixel_id);
92		}
93		var applied = valid && projection !== null;
94		try {
95			if (typeof console !== 'undefined' && typeof console.info === 'function') {
96				console.info('[FS-3585][META_EVENT_DRY_RUN]', {
97					feature_key: 'FS-3585', mode: 'dry_run', provider: 'meta', event_name: 'InitiateCheckout',
98					disposition: !valid ? 'invalid_response' : (applied ? 'projection_applied' : 'projection_absent'),
99					compatibility_applied: applied, pixel_override: applied, pixel_id: applied ? projection.pixel_id : null,
100					payload: {value: parseInt(total_price).toFixed(2), currency: currency}, options: {eventID: event_id}
101				});
102			}
103		} catch (e) { /* 관측 실패는 결제 진행과 미송신 경계를 바꾸지 않는다. */ }
104	};
105	var AddPaymentInfo = function(){	/* 결제 정보 추가 */
106		//console.log("FB_PIXEL - AddPaymentInfo");
107		if (typeof fbq != 'undefined') fbq('track', 'AddPaymentInfo');
108	};
109	var Purchase = function(value,currency,flag_code,fb_external_id){
110		/* 결제 완료 */
111		var dispatchPurchase = function() {
112			var content_ids = [];
113			/* content_ids 설정 - order_info 에서 id만 뽑아서 생성해준다. */
114			order_info.forEach(function(obj) {
115				if (content_ids.indexOf(obj.id) == -1) content_ids.push(obj.id);
116			});
117
118			console.log("dispatchPurchaseFree : ", value, ", ", currency);
119			// value가 숫자이고 currency가 존재할 때만 track
120			if (!isNaN(parseFloat(value)) && currency) {
121				console.log("dispatchPurchaseTrack : ", value, ", ", currency);
122				// Purchase 이벤트 전송
123				fbq('track', 'Purchase', {
124					content_ids: content_ids,
125					content_type: 'product',
126					contents: order_info,
127					value: parseFloat(value),
128					currency: currency
129				}, { eventID: flag_code });
130			}
131		};
132
133		// fbq가 이미 로드되어 있으면 즉시 전송
134		if (typeof fbq !== 'undefined') {
135			dispatchPurchase();
136			return;
137		}
138
139		// window.fbq 할당 감지를 위한 descriptor 사용
140		var originalFbq = window.fbq;
141		var fbqDetected = false;
142
143		try {
144			// Object.defineProperty를 사용해서 fbq 할당 감지
145			Object.defineProperty(window, 'fbq', {
146				get: function() {
147					return originalFbq;
148				},
149				set: function(value) {
150					originalFbq = value;
151					if (!fbqDetected && typeof value === 'function') {
152						fbqDetected = true;
153						setTimeout(function() {
154							dispatchPurchase();
155						}, 0);
156					}
157				},
158				configurable: true
159			});
160		} catch(e) {
161			// defineProperty가 실패하는 경우 (IE8 등) 폴백
162			var checkFbq = function() {
163				if (typeof window.fbq !== 'undefined' && !fbqDetected) {
164					fbqDetected = true;
165					dispatchPurchase();
166				} else if (!fbqDetected) {
167					setTimeout(checkFbq, 100);
168				}
169			};
170			setTimeout(checkFbq, 100);
171		}
172
173		// 10초 타임아웃으로 강제 정리
174		setTimeout(function() {
175			fbqDetected = true; // 더 이상 감지하지 않음
176		}, 10000);
177	};
178	var CompleteRegistration = function(type,currency,id){
179		if(type == 'join'){
180			if (typeof fbq != 'undefined') fbq('track', 'CompleteRegistration',{'id' : id , 'value' : 0, 'currency' : currency});
181		}else{
182			if (typeof fbq != 'undefined') fbq('track', 'CompleteRegistration',{'value' : 0, 'currency' : currency});
183		}
184	};
185
186
187	var use_npay_count = false;
188	var setUseNpayCount = function(b){
189		use_npay_count = (b === true);
190	};
191	var addNpayOrder = function(order_data){
192		if(!use_npay_count) return false;
193		if( typeof order_data == 'undefined') return false;
194		if( typeof order_data['list'] == 'undefined') return false;
195		// 네이버 페이도 구매전환에 포함하게끔 옵션을 사용할 경우에는 구매완료를 바로 보낸다
196
197		var np_fb_data = {'total_price': 0, 'currency': order_data['currency']};
198		var npay_order_item = {};
199		for(var i = 0; i<order_data['list'].length; i++){
200			npay_order_item = order_data['list'][i];
201			AddOrderInfo(npay_order_item['prod_idx'], npay_order_item['count'], npay_order_item['price']);
202		}
203		np_fb_data['total_price'] = order_data['total_price'];
204		np_fb_data['pc_event_id'] = order_data['pc_event_id'];
205		np_fb_data['fb_external_id'] = order_data['fb_external_id'];
206
207		Purchase(np_fb_data['total_price'], np_fb_data['currency'], np_fb_data['pc_event_id'],np_fb_data['fb_external_id']);
208	};
209	return {
210		"ViewContent" : function(id,name,value,currency){
211			ViewContent(id,name,value,currency);
212		},
213		"AddToCart" : function(id, name, price,currency,count,total_price,event_id,fb_external_id){
214			AddToCart(id, name, price,currency,count,total_price,event_id,fb_external_id);
215		},
216		"AddToCartDryRun" : AddToCartDryRun,
217		"AddOrderInfo" : function(idx,ea,price){
218			AddOrderInfo(idx,ea,price);
219		},
220		"AddToWishlist" : function(){
221			AddToWishlist();
222		},
223		"InitiateCheckout" : function(event_id,total_price,currency,fb_external_id){
224			InitiateCheckout(event_id,total_price,currency,fb_external_id);
225		},
226		"InitiateCheckoutDryRun" : InitiateCheckoutDryRun,
227		"AddPaymentInfo" : function(){
228			AddPaymentInfo();
229		},
230		"Purchase" : function(value,currency,order_no,fb_external_id){
231			Purchase(value,currency,order_no,fb_external_id);
232		},
233		"CompleteRegistration" : function(type,currency,id){
234			CompleteRegistration(type,currency,id);
235		},
236		"setUseNpayCount": function(b){
237			setUseNpayCount(b);
238		},
239		"addNpayOrder" : function(order_data){
240			addNpayOrder(order_data);
241		}
242	}
243}();

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.