Google analytics 谷歌分析电子商务跟踪修改?

Google analytics 谷歌分析电子商务跟踪修改?,google-analytics,e-commerce,Google Analytics,E Commerce,正在考虑将Google Analytics电子商务跟踪添加到一个在封闭源代码电子商务平台上运行的网站。谷歌在其帮助系统中为我们提供了以下代码作为示例: <html> <head> <title>Receipt for your clothing purchase from Acme Clothing</title> <script type="text/javascript"> var _gaq = _gaq || []; _

正在考虑将Google Analytics电子商务跟踪添加到一个在封闭源代码电子商务平台上运行的网站。谷歌在其帮助系统中为我们提供了以下代码作为示例:

<html>
<head>
<title>Receipt for your clothing purchase from Acme Clothing</title>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_addTrans',
    '1234',           // transaction ID - required
    'Acme Clothing',  // affiliation or store name
    '11.99',          // total - required
    '1.29',           // tax
    '5',              // shipping
    'San Jose',       // city
    'California',     // state or province
    'USA'             // country
  ]);

   // add item might be called for every item in the shopping cart
   // where your ecommerce engine loops through each item in the cart and
   // prints out _addItem for each
  _gaq.push(['_addItem',
    '1234',           // transaction ID - required
    'DD44',           // SKU/code - required
    'T-Shirt',        // product name
    'Green Medium',   // category or variation
    '11.99',          // unit price - required
    '1'               // quantity - required
  ]);
  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body>

  Thank you for your order.  You will receive an email containing all your order details.

</body>
</html>

从Acme服装公司购买服装的收据
var _gaq=_gaq | |[];
_gaq推送(['''u setAccount','UA-XXXXX-X']);
_gaq.push([''u trackPageview']);
_gaq.push(['''u addTrans',
“1234”,//事务ID-必需
“Acme服装”,//附属机构或商店名称
“11.99”,//总计-必填项
‘1.29’,//税
'5',//装运
'圣何塞',//城市
'加利福尼亚',//州或省
“美国”//国家/地区
]);
//可能会为购物车中的每个项目调用add item
//您的电子商务引擎在购物车和
//打印出每个项目的附加项
_gaq.push(附加项),
“1234”,//事务ID-必需
“DD44”,//SKU/代码-必需
'T恤',//产品名称
“绿色介质”,//类别或变体
'11.99',//单价-必需
'1'//数量-必需
]);
_gaq.push([''u trackTrans'])//将事务提交到分析服务器
(功能(){
var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl' : 'http://www“)+”.google analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);
})();
谢谢您的订单。您将收到一封包含所有订单详细信息的电子邮件。

这只是放在最终销售页面上,还是我需要对数据做些什么?由于以前从未这样做过,该网站正在php/mysql脚本上运行。

要实现GA电子商务跟踪,您需要知道您的购物车变量名称(orderTotal、orderArray等-因每个购物车平台而异)以及在呈现感谢页面时如何将它们插入脚本中,以便客户的订单具有正确的详细信息

通常,您需要插入所有addTrans变量,然后为addItem执行循环(购物车中的每个项目一次)。但是,这个细节实际上取决于你的购物车,所以我不能说得更具体

根据您购物车社区的规模/悟性,您可能会找到一个预先制作好的示例,您可以将其放到您的感谢页面模板上,或者它甚至可以将其作为一个模块内置