๋น๊ทผ ์ ํ ์ถ์ ์ฝ๋ ์์
์์ ์ฝ๋์ด๋ฉฐ ๋์์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
๋ชจ๋ฐ์ผ ํ์ด์ง๊ฐ ์๋ค๋ฉด, ๋์์ธ ๋ฐ ๋ชจ๋ฐ์ผ ์ผํ๋ชฐ ๋ชจ๋ ์์
ํด์ฃผ์
์ผ ํฉ๋๋ค.
๊ณตํต ์คํฌ๋ฆฝํธ (ViewPage and Config)
<!-- Danggeun Market Common Code -->
<script src="https://karrot-pixel.business.daangn.com/0.2/karrot-pixel.umd.js">
</script>
<script>
window.karrotPixel.init("์ ํ ์ถ์ ์ฝ๋ ID"); // ๋น๊ทผ์์ ๋ฐ๊ธ ๋ฐ์ ์ ํ์ถ์ ์ฝ๋ ID ์
๋ ฅ.
window.karrotPixel.track("ViewPage");
</script>
<!-- Danggeun Market Common Code -->
์ํ์์ธํ์ด์ง (ViewContent)
<!-- Danggeun Market ViewContent Code -->
<script>
window.karrotPixel.track("ViewContent", {
id: "{=goodsView['goodsNo']}",
});
</script>
<!-- Danggeun Market ViewContent Code -->
์ฅ๋ฐ๊ตฌ๋ ํ์ด์ง (AddToCart)
์ฅ๋ฐ๊ตฌ๋ ๋ฒํผ ํด๋ฆญ ๋๋ ํผ ๋ฐ์ดํฐ ์ ์ก ์ ์คํฌ๋ฆฝํธ๊ฐ ์คํ๋์ด์ผ ํ์ง๋ง,
์ผํ๋ชฐ์ ์ปค์คํ
์ค์ ์ ๋ฐ๋ผ ์ ํ์(selector)๋ ์์น๊ฐ ๋ณ๊ฒฝ๋ ์ ์์ต๋๋ค.
๋ฐ๋ผ์, ์ฅ๋ฐ๊ตฌ๋์ ์ํ์ด ์กด์ฌํ ๊ฒฝ์ฐ์๋ง ์คํฌ๋ฆฝํธ๊ฐ ๋์ํ๋๋ก ์ค์ ํ๋
๊ฐ๋จํ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<!-- Danggeun Market AddToCart Code -->
<script>
const karrotPixelAddToCartItems = [];
</script>
<!-- Danggeun Market AddToCart Code -->
<!-- Danggeun Market AddToCart Code -->
<script>
karrotPixelAddToCartItems.push({
id: "{=...goodsNo}",
name: "{=gd_remove_only_tag(...goodsNm)}",
quantity: "{=...goodsCnt}",
price: "{=...price['goodsPriceSubtotal']}".replace(/,/g, ""),
});
</script>
<!-- Danggeun Market AddToCart Code -->
<!-- Danggeun Market AddToCart Code -->
<script>
if (karrotPixelAddToCartItems.length > 0) {
window.karrotPixel.track("AddToCart", {
products: karrotPixelAddToCartItems,
});
}
</script>
<!-- Danggeun Market AddToCart Code -->
ํ์๊ฐ์
์๋ฃ(CompleteRegistration)
<!-- Danggeun Market CompleteRegistration Code -->
<script>
window.karrotPixel.track("CompleteRegistration");
</script>
<!-- End Danggeun CompleteRegistration Market Code -->
<!-- Danggeun Market Purchase Code -->
<script>
let karrotPixelPurchaseItemsQty = 0;
<!--{ @ orderInfo.goods }-->
karrotPixelPurchaseItemsQty += {=.goodsCnt};
<!--{ / }-->
let karrotPixelPurchaseItems = [
<!--{ @ orderInfo.goods }-->
{
'id': "{=.goodsNo}",
'name': "{=.goodsNm}",
'quantity': "{=.goodsCnt}",
'price': "{=.goodsPrice}".replace(/\.00$/, ''),
},
<!--{ / }-->
];
window.karrotPixel.track("Purchase", {
total_price: "{=orderInfo.settlePrice}".replace(/\.00$/, ''),
total_quantity: String(karrotPixelPurchaseItemsQty),
products: karrotPixelPurchaseItems,
});
</script>
<!-- End Danggeun Market Purchase Code -->