Last updated
<!-- 예시코드 -->
<script type="text/javascript">
globalThis._tfa = globalThis._tfa || [];
globalThis._tfa.push({ notify: "event", name: "page_view", id: {{광고주아이디});
!(function (t, f, a, x) {
if (!document.getElementById(x)) {
t.async = 1;
t.src = a;
t.id = x;
f.parentNode.insertBefore(t, f);
}
})(
document.createElement("script"),
document.getElementsByTagName("script")[0],
"//cdn.taboola.com/libtrc/unip/{{광고주아이디}/tfa.js",
"tb_tfa_script"
);
</script><!-- 예시 코드 -->
<script>
try {
const { orderOptionsGroupByPartner = [] } = sb.order;
const orderProducts = orderOptionsGroupByPartner.flatMap(
({ orderOptionsGroupByDelivery }) =>
orderOptionsGroupByDelivery.flatMap(({ orderOptions }) => orderOptions)
);
const orderid = sb.order.orderNo;
const productNos = orderProducts.map(({ productNo }) => String(productNo));
const revenue = orderProducts.reduce((accumulator, product) => {
return accumulator + (product.orderCnt * product.price.buyPrice);
}, 0);
const quantity = orderProducts.reduce((acc, product) => {
acc += product.orderCnt ? product.orderCnt : 0;
return acc;
}, 0);
_tfa.push({
notify: "event",
name: "purchase",
id: "{{광고주아이디}}", // 광고주 아이디로 변경해주세요(type:int)
orderid,
quantity,
revenue,
currency: "KRW",
});
} catch (error) {
console.error("An error occurred:", error);
}
</script>