【发布时间】:2021-09-30 06:50:30
【问题描述】:
我从未使用过这项技术(我也不打算使用),但我需要一个解决方案,了解如何在结帐页面上插入 GTM 分析。
基本上,我什至不知道结帐的代码在哪里。
请帮忙?
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'purchase-gtm',
'ecommerce': {
'purchase': {
'actionField': {
'id': '{{checkout.order.id}}', // order number
'revenue': '{{checkout.order.total.value}}', // total transaction value (incl. tax and shipping)
'tax':'{{ecommerce.tax}}',
'shipping': '{{ecommerce.shipping}}'
},
'products': [
{{#each checkout.order.items}}
{
'name': '{{name}}', //Product Name
'id': '{{product_id}}', //Product ID
'price': '{{price.value}}', //Product Price
'brand': '{{brand.name}}', //Product Brand
'category': '{{category}}', //Product Category
'quantity': '{{quantity}}',
'variant': '{{sku}}', //Product variant if applicable
},
{{/each}}
],
}
}
});
</script>
作为示例的代码。
【问题讨论】:
标签: javascript checkout bigcommerce