// 픽셀아이디 입력 부분 변경 필수
<script>
!(function (f, b, e, v, n, t, s) {
if (f.fbq) return;
n = f.fbq = function () {
n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = "2.0";
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s);
})(
window,
document,
"script",
"https://connect.facebook.net/en_US/fbevents.js"
);
fbq("init", "픽셀아이디"); // ""(쌍따옴표)는 지우지 마세요.
fbq("track", "PageView");
</script>
<noscript
><img
height="1"
width="1"
style="display: none"
src="https://www.facebook.com/tr?id=픽셀아이디&ev=PageView&noscript=1"
/></noscript>
// ViewContent Event
<!-- Facebook Pixel viewContent Code -->
<script>
try {
fbq("track", "ViewContent", {
content_ids: ["{=goodsView['goodsNo']}"],
content_type: "product",
value: {=goodsView['goodsPrice']},
currency: "KRW",
});
} catch (error) {
console.error("FB Pixel ViewContent Error: ", error);
}
</script>
// AddToCart
<!-- Facebook Pixel Add to Cart Code NHN Commerce -->
<script>
const fbItems = [];
</script>
치환코드 <!--{@..value_ }--> 하단
// AddToCart
<!-- Facebook Pixel Add to Cart Code NHN Commerce -->
<script>
fbItems.push("{=...goodsNo}");
</script>
// AddToCart
<!-- Facebook Pixel Add to Cart Code NHN Commerce -->
<script>
try {
if (fbItems.length > 0) {
fbq("track", "AddToCart", {
content_ids: fbItems,
content_type: "product",
value: Number("{=totalGoodsPrice}".replace(/['원', ',']/g, "")),
currency: "KRW",
});
}
} catch (error) {
console.error("FB Pixel AddToCart Error: ", error);
}
</script>
// CompleteRegistration
<!-- Facebook Pixel JoinOK Code -->
<script>
try {
fbq("track", "CompleteRegistration", {
currency: "KRW",
content_name: "JoinOK",
value: "1",
});
} catch (error) {
console.error("FB Pixel CompleteRegistration Error: ", error);
}
</script>
// Purchase
<!-- Facebook Pixel Purchase Code NHN Commerce -->
<script>
const goodsNo = [
<!--{ @ orderInfo.goods }-->
'{=.goodsNo}',
<!--{ / }-->
];
fbq("track", "Purchase", {
content_ids: goodsNo,
content_type: "product",
value: {=orderInfo.settlePrice},
currency: "KRW",
});
</script>