用Google Analytics分析ECShop的数据

Google Analytics很强大....

 

1,注册:http://www.google.com/analytics

2,创建账号、站点.

3,设置站点时要将“电子商务”(Ecommerce)选成"yes".

4,在ECSHOP themes/library/page_footer.lbi 的末尾,加上google analytics的统计代码

(要将UA-xxxxxx-1改成自己的)

 

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxx-1");
pageTracker._trackPageview();
<!-- {if $step eq "done"} 订单提交成功-->
pageTracker._addTrans(
    "<!--{$order.order_sn}-->",                                     // Order ID
    "<!--{$order.parent_id}-->",                            // Affiliation
    "<!--{$order.goods_amount}-->",                                    // Total
    "0",                                     // Tax
    "<!--{$order.shipping_fee}-->",                                        // Shipping
    "<!--{$order.city}|{$order.district}-->",                                 // City
    "<!--{$order.province}-->",                               // State
    "<!--{$order.country}-->"                                       // Country
  );

<!--{foreach from=$goods_list item=goods}-->
  pageTracker._addItem(
    "<!--{$order.order_sn}-->",                                     // Order ID
    "<!--{$goods.goods_sn}-->",                                     // SKU
    "<!--{$goods.goods_name}-->",                                  // Product Name
    "<!--{$goods.goods_id}-->",                             // Category
    "<!--{$goods.goods_price}-->",                                    // Price
    "<!--{$goods.goods_number}-->"                                         // Quantity
  );
<!--{/foreach}-->
  pageTracker._trackTrans();
<!-- {/if} -->
} catch(err) {}</script>
posted @ 2012-10-18 11:08  梦话四叶  阅读(270)  评论(0编辑  收藏  举报