简体   繁体   English

Google Analytics(分析)电子商务跟踪自定义项

[英]Google Analytics eCommerce tracking custom items

I have a question regarding tracking conversions and adding custom items if possible, I currently have installed the eCommerce tracking snippet on a hotel website to track reservations and it is working fine when passing REVENUE (total price), ID (confirmation number) and NAME (room name). 我有一个有关跟踪转化并在可能的情况下添加自定义项目的问题,我目前在酒店网站上安装了电子商务跟踪代码段以跟踪预订,并且在传递REVENUE(总价),ID(确认号)和NAME(房间名称)。 However, there other few items I would like to transmit as well such as number of nights and arrival and departure dates so my question is, can I include custom items to the addTransaction object? 但是,还有其他一些我想传送的项目,例如夜数以及到达和离开的日期,所以我的问题是,我可以将自定义项目包括在addTransaction对象中吗? or rename ones that I don't need like shipping and sku? 或重命名不需要的商品(例如运输和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');

I'm using the analytics.js library by the way Thanks for your help 我正在使用analytics.js库谢谢您的帮助

https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-activities Create a product level custom dimension instead Eg: 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).
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM