我已将以下代码添加到我的网站的head标签中,但是当我浏览页面并进行交易时,数据不会流到Google Analytics(分析)仪表板上的Real-Time(事件)选项卡。但是,当我转到“实时”->“内容”选项卡时(它显示了最近30分钟内查看的所有页面),我可以看到数据。
<script>
(function(w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-PCQXYZ2');
</script><script type="text/javascript">
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
"event": "transaction_completed_event",
"transactionId": "12345",
"transactionAffiliation": "18CA",
"transactionTotal": 0.01,
"transactionTax": 0,
"transactionShipping": 0,
"transactionProducts": [{
"sku": "SKU-TEST",
"name": "Product Name Test",
"category": "Category Test",
"price": 0.01,
"quantity": 1
}]
});
</script>
我在这里想念什么吗?
您使用的代码与增强型电子商务无关,而与标准电子商务有关:https://support.google.com/tagmanager/answer/6107169?hl=en