์์ ์ฝ๋์ด๋ฉฐ ๋์์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
๊ณ ๋๋ชฐ์ ๊ฒฝ์ฐ ์์ง ํฑํก ์นดํ๋ก๊ทธ ๊ด๊ณ ๋ฅผ ์ํ ํผ๋๊ฐ ๊ฐ๋ฐ๋์ด ์์ง ์์ต๋๋ค.
๊ณตํต๋ ์ด์์ ํน์ ์ธ๋ถ์คํฌ๋ฆฝํธ๋ฅผ ์ด์ฉํด ์ ์ฉ. (ํฝ์
์์ด๋๋ฅผ ๋ณ๊ฒฝํด์ฃผ์๊ธฐ ๋ฐ๋๋๋ค.)
PC ์ผํ๋ชฐ ๋ฐ ๋ชจ๋ฐ์ผ ์ผํ๋ชฐ์ ๋ชจ๋ ์ ์ฉํด์ฃผ์
์ผ ํฉ๋๋ค.
<script>
!(function (w, d, t) {
w.TiktokAnalyticsObject = t;
var ttq = (w[t] = w[t] || []);
(ttq.methods = [
"page",
"track",
"identify",
"instances",
"debug",
"on",
"off",
"once",
"ready",
"alias",
"group",
"enableCookie",
"disableCookie",
]),
(ttq.setAndDefer = function (t, e) {
t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
};
});
for (var i = 0; i < ttq.methods.length; i++)
ttq.setAndDefer(ttq, ttq.methods[i]);
(ttq.instance = function (t) {
for (var e = ttq._i[t] || [], n = 0; n < ttq.methods.length; n++)
ttq.setAndDefer(e, ttq.methods[n]);
return e;
}),
(ttq.load = function (e, n) {
var i = "https://analytics.tiktok.com/i18n/pixel/events.js";
(ttq._i = ttq._i || {}),
(ttq._i[e] = []),
(ttq._i[e]._u = i),
(ttq._t = ttq._t || {}),
(ttq._t[e] = +new Date()),
(ttq._o = ttq._o || {}),
(ttq._o[e] = n || {});
var o = document.createElement("script");
(o.type = "text/javascript"),
(o.async = !0),
(o.src = i + "?sdkid=" + e + "&lib=" + t);
var a = document.getElementsByTagName("script")[0];
a.parentNode.insertBefore(o, a);
});
ttq.load("{{ํฝ์
์์ด๋๋ฅผ ์
๋ ฅํด์ฃผ์ธ์}}"); // ํฑํก์์ ๋ฐ๊ธ ๋ฐ์ ํฝ์
์์ด๋ ์
๋ ฅ
ttq.page();
})(window, document, "ttq");
</script>
์ฅ๋ฐ๊ตฌ๋ ๋ฒํผ ํด๋ฆญ ๋๋ ํผ ๋ฐ์ดํฐ ์ ์ก ์ ์คํฌ๋ฆฝํธ๊ฐ ์คํ๋์ด์ผ ํ์ง๋ง,
์ผํ๋ชฐ์ ์ปค์คํ
์ค์ ์ ๋ฐ๋ผ ์ ํ์(selector)๋ ์์น๊ฐ ๋ณ๊ฒฝ๋ ์ ์์ต๋๋ค.
๋ฐ๋ผ์, ์ฅ๋ฐ๊ตฌ๋์ ์ํ์ด ์กด์ฌํ ๊ฒฝ์ฐ์๋ง ์คํฌ๋ฆฝํธ๊ฐ ๋์ํ๋๋ก ์ค์ ํ๋
๊ฐ๋จํ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
<script>
const tiktokCartItems = [];
</script>
<script>
tiktokCartItems.push({
content_id: "{=...goodsNo}",
content_name: "{=gd_remove_only_tag(...goodsNm)}",
quantity: {=...goodsCnt},
price: Number("{=...price['goodsPriceSubtotal']}".replace(/,/g,'')),
});
</script>
<script>
if (tiktokCartItems.length > 0) {
ttq.track("AddToCart", {
contents: tiktokCartItems,
content_type: "product",
value: Number("{=totalSettlePrice}".replace(/,/g, "")),
currency: "KRW",
});
}
</script>
<!-- ์์ ์ฝ๋ -->
<script>
let tiktokGoodsInfo = [
<!--{ @ orderInfo.goods }-->
{
content_id: '{=.goodsNo}',
content_name: '{=.goodsNm}',
quantity: {=.goodsCnt},
price: {=.goodsPrice}
},
<!--{ / }-->
];
ttq.track("CompletePayment", {
contents: tiktokGoodsInfo,
content_type: "product",
value: {=orderInfo.settlePrice},
currency: "KRW",
});
</script>