Google Analytics 电子商务跟踪自定义项目
Google Analytics eCommerce tracking custom items
我有一个关于跟踪转化和尽可能添加自定义项目的问题,我目前已经在酒店网站上安装了电子商务跟踪代码段来跟踪预订,并且在传递 REVENUE(总价)、ID(确认号码)和名称(房间名称)。但是,我还想传输其他一些项目,例如住宿天数以及到达和离开日期,所以我的问题是,我可以将自定义项目包含到 addTransaction 对象中吗?或者重命名我不需要的东西,比如运费和 sku?
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XXX-XXX-XXX', 'auto');
ga('send', 'pageview');
ga('require', 'ecommerce', 'ecommerce.js');
// General Booking transaction
ga('ecommerce:addTransaction',{
'id' : confirmationNumber, // Confirmation Nimber
'revenue' : totalBooking, //Booking total plus taxes
'affiliation' : hotelName, //Hotel name
'currency' : 'USD'
});
// OPTIONAL: detailed room info
ga('ecommerce:addItem', {
'id': roomID, // Room ID.
'name': roomName, // Room Name
'price': nightlyRate, // Nightly rate (maybe)
'quantity': totalRooms // Number of rooms.
});
//Send transaction data
ga('ecommerce:send');
顺便说一下,我正在使用 analytics.js 库 谢谢你的帮助
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-activities 创建产品级自定义维度,例如:
ga('ec:addProduct', { // Provide product details in a productFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'position': 1, // Product position (number).
'dimension1': '4' // Custom dimension Number of Nights (string).
'dimension2': 'October' // Custom dimension Arrival Date (string).
});
我有一个关于跟踪转化和尽可能添加自定义项目的问题,我目前已经在酒店网站上安装了电子商务跟踪代码段来跟踪预订,并且在传递 REVENUE(总价)、ID(确认号码)和名称(房间名称)。但是,我还想传输其他一些项目,例如住宿天数以及到达和离开日期,所以我的问题是,我可以将自定义项目包含到 addTransaction 对象中吗?或者重命名我不需要的东西,比如运费和 sku?
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'XXX-XXX-XXX', 'auto');
ga('send', 'pageview');
ga('require', 'ecommerce', 'ecommerce.js');
// General Booking transaction
ga('ecommerce:addTransaction',{
'id' : confirmationNumber, // Confirmation Nimber
'revenue' : totalBooking, //Booking total plus taxes
'affiliation' : hotelName, //Hotel name
'currency' : 'USD'
});
// OPTIONAL: detailed room info
ga('ecommerce:addItem', {
'id': roomID, // Room ID.
'name': roomName, // Room Name
'price': nightlyRate, // Nightly rate (maybe)
'quantity': totalRooms // Number of rooms.
});
//Send transaction data
ga('ecommerce:send');
顺便说一下,我正在使用 analytics.js 库 谢谢你的帮助
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-activities 创建产品级自定义维度,例如:
ga('ec:addProduct', { // Provide product details in a productFieldObject.
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'position': 1, // Product position (number).
'dimension1': '4' // Custom dimension Number of Nights (string).
'dimension2': 'October' // Custom dimension Arrival Date (string).
});