Online Store → Themes → Edit code → Layout/theme.liquid
에서 </head>
또는 </body>
직전에 아래 코드를 추가하세요.
<script>
window.DF_WIDGET_CONFIG = {
identifier: "YOUR_CHATBOT_IDENTIFIER",
apiBase: "https://your-app.com",
theme: "light",
language: "ko"
};
</script>
<script async src="https://your-app.com/widget.js"></script>
Liquid 변수를 활용해 로그인한 고객 정보를 metadata
로 전달할 수 있습니다.
<script>
window.DF_WIDGET_CONFIG = {
identifier: "YOUR_CHATBOT_IDENTIFIER",
apiBase: "https://your-app.com",
theme: "light",
language: "ko",
ui: {
position: "bottom-right",
primary_color: "#000000"
},
metadata: function() {
return {
customer_id: {{ customer.id | json }},
customer_email: {{ customer.email | json }},
customer_tags: {{ customer.tags | json }},
order_count: {{ customer.orders_count | json }},
shop: {{ shop.domain | json }}
};
},
context: function() {
return {
product_id: {{ product.id | default: null | json }},
collection_id: {{ collection.id | default: null | json }},
cart_total: {{ cart.total_price | money_without_currency | json }}
};
}
};
</script>
<script async src="https://your-app.com/widget.js"></script>