範例:shopify 送出訂單
Google Tag Manager 安裝
Last updated
<script>
var data = {
'product': '',
'amount': ( {{shopify [begin_checkout] purchase_price}} !== undefined )? {{shopify [begin_checkout] purchase_price}}: ''
};
if({{shopify [begin_checkout] purchase_items}} !== undefined){
var items = {{shopify [begin_checkout] purchase_items}};
for(var i in items){
if(items[i] !== undefined){
data.product += (data.product == '')? items[i].item_id : ',' + items[i].item_id;
}
}
if(data.product != ''){
itg('event', 'purchase',{
'id': '',
'price': data.amount,
'promotion': '',
'product': data.product
});
}
}
</script>