<!DOCTYPE html>
<html lang="ko"
	xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : GoodsDetailScriptsWeb.html
 * @desc    : 상품상세 광고 스크립트
 *============================================================================
 * pastelmall.com
 * Copyright(C) 2020 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.03.18   eskim     최초 작성
 *******************************************************************************
 -->
<th:block th:fragment="scripts">
	<script th:inline="javascript">

		window._eglqueue = window._eglqueue || [];
		_eglqueue.push(['setVar', 'cuid', eglqueueCuid]);
		_eglqueue.push(['setVar', 'itemId', [[${goodsInfo.goodsCd}]]]);
		_eglqueue.push(['setVar', 'userId', hCustId]);
		_eglqueue.push(['setVar', 'categoryId', cateNm]);
		_eglqueue.push(['setVar', 'brandId', [[${goodsInfo.brandGroupNo}]]]);
		_eglqueue.push(['track', 'view']);
		_eglqueue.push(['track', 'product']);
		(function (s, x) {
		s = document.createElement('script'); s.type = 'text/javascript';
		s.async = true; s.defer = true; s.src = (('https:' == document.location.protocol) ? 'https' : 'http') + '://logger.eigene.io/js/logger.min.js';
		x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
		})();
		
	</script>

	<!-- Criteo 상품 태그 --> <!-- 적용완료 -->
	<script th:inline="javascript">
		window.criteo_q = window.criteo_q || [];
		var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
		window.criteo_q.push(
			{ event: "setAccount", account: 6762}, // 이 라인은 업데이트하면 안됩니다
			{ event: "setEmail", email: criteoEmail}, // 유저가 로그인이 안되 있는 경우 빈 문자열을 전달
			{ event: "setSiteType", type: deviceType},
			{ event: "viewItem", item: [[${goodsInfo.goodsCd}]]+''}); 
	</script>
	<!-- END Criteo 상품 태그 -->

	<!-- Enliple(모비온) Tracker Start -->
	<script th:inline="javascript">
		var ENP_VAR = {
			collect: {},
			conversion: { product: [] }
		};
		
		// 광고 스크립트용
		var goodsNavigation = [[${goodsNavigation}]];
		var cate1No = "";
		var cate2No = "";
		var cate3No = "";
		var cate4No = "";
		var cate5No = "";
		var cate1Nm = "";
		var cate2Nm = "";
		var cate3Nm = "";
		var cate4Nm = "";
		var cate5Nm = "";
		if (!gagajf.isNull(goodsNavigation)) {
			cate1No = goodsNavigation.cate1No;
			cate2No = goodsNavigation.cate2No;
			cate3No = goodsNavigation.cate3No;
			cate4No = goodsNavigation.cate4No;
			cate5No = goodsNavigation.cate5No;
			cateNm  = cate3No;
			cate1Nm = goodsNavigation.cate1Nm;
			cate2Nm = goodsNavigation.cate2Nm;
			cate3Nm = goodsNavigation.cate3Nm;
			cate4Nm = goodsNavigation.cate4Nm;
			cate5Nm = goodsNavigation.cate5Nm;
		}
		// 광고 스크립트용

		var snsGoodsImg = _uploadGoodsUrl + "/" + [[${goodsInfo.sysImgNm}]];
		
		ENP_VAR.collect.productCode = [[${goodsInfo.goodsCd}]];
		ENP_VAR.collect.productName = [[${goodsInfo.goodsFullNm}]];
		ENP_VAR.collect.price = [[${goodsInfo.listPrice}]];
		ENP_VAR.collect.dcPrice = [[${goodsInfo.currPrice}]];
		ENP_VAR.collect.soldOut = 'N';
		ENP_VAR.collect.imageUrl = snsGoodsImg;
 		ENP_VAR.collect.secondImageUrl = '';
 		ENP_VAR.collect.thirdImageUrl = '';
 		ENP_VAR.collect.fourthImageUrl = '';
		ENP_VAR.collect.topCategory = cate1Nm;
		ENP_VAR.collect.firstSubCategory = cate1Nm;
		ENP_VAR.collect.secondSubCategory = cate2Nm;
		ENP_VAR.collect.thirdSubCategory = cate3Nm;

		/* 간편 결제 시스템을 통한 전환. (이용하지 않는 경우 삭제) */
// 		ENP_VAR.conversion.product.push({
// 			productCode : [[${goodsInfo.goodsCd}]]],
// 			productName : [[${goodsInfo.goodsFullNm}]],
// 			price : [[${goodsInfo.listPrice}]],
// 			dcPrice : [[${goodsInfo.currPrice}]],
// 			qty : [[${goodsInfo.goodsStockQty}]],
// 			soldOut : 'N',
// 			imageUrl : snsGoodsImg,
// 			topCategory : cate1Nm,
// 			firstSubCategory : cate1Nm,
// 			secondSubCategory : cate2Nm,
// 			thirdSubCategory : cate3Nm
// 		});

		/* 상품수집 */
		enp('create', 'collect', 'is24', { device: 'M' });
		
		/* 장바구니 버튼 타겟팅 */
		enp('create', 'cart', 'is24', { device: 'M', btnSelector: '.enp_mobon_cart' });
		
		/* 찜 버튼 타겟팅 */
		enp('create', 'wish', 'is24', { device: 'M', btnSelector: '.enp_mobon_wish' });
	
// 		/* 네이버페이 전환 (이용하지 않는 경우 삭제) */
// 		enp('create', 'conversion', 'is24', { device: 'B', paySys: 'naverPay' });
	</script>
	<!-- Enliple(모비온) Tracker End -->

	<!-- 픽셀 -->
	<script th:inline="javascript">
		fbq('track', 'ViewContent', {
			value: [[${goodsInfo.currPrice}]],
			currency: 'KRW',
			contents: [
				{
					id: [[${goodsInfo.goodsCd}]],
					name: [[${goodsInfo.goodsFullNm}]],
					category: cateNm
				}
			]
		});

	</script>
</th:block>
</html>