我正在尝试在Google跟踪代码管理器中设置标准电子商务。
但是,Google Analytics(分析)没有收到我的交易数据;我正在尝试通过Google跟踪代码管理器的dataLayer
将数据推送到Google Analytics(分析)-但是,当我重新加载收据页面时,Google Analytics(分析)仪表板中没有任何报告。
这是我写的代码:(此代码执行在上方GTM标签)
window.dataLayer = window.dataLayer || [];
@*Send the receipt information to Google*@
dataLayer.push(
{
'transactionId': '@Model.StudentCheckoutReceiptId',
'transactionAffiliation': 'AcmeStudios',
'transactionRevenue': @Model.Total,
'transactionShipping': '@Model.ShippingOptionPurchased.ToString()',
'transactionProducts': {
'id': '@Model.StudentCheckoutReceiptId',
'name': '@packageOption',
'price': @Model.Total,
'quantity': 1
}
});
// GTM include
....
// End GTM include
但是,Google Analytics(分析)没有收到任何信息:
我的收据页面的网址:
https://acmestudios.com/receipt/1aa2726f-9881-43b4-ba42-34a5510d8e67
我想念什么?
答案 0 :(得分:0)
我正确地设置了所有内容,但dataLayer对象不正确;如果您不遵循Google指定的格式和变量名完全,那么它将无法正常工作;您还需要确保传入任何Required
参数。这是我的dataLayer现在的样子:
@*Send the receipt information to Google*@
dataLayer.push(
{
'transactionId': '@Model.ReceiptId',
'transactionAffiliation': 'AcmeProducts',
'transactionTotal': @Model.Total,
'transactionShipping': '@Model.ShippingOptionPurchased.ToString()',
'transactionProducts': [{
'name': '@packageOption',
'sku': 'none',
'price': @Model.Total,
'quantity': 1
}]
});