box-buy-analysis.phtml 2.86 KB
{{#if orderGoods}}
    <script type="text/javascript">
        var ga = ga || function () {
                (ga.q = ga.q || []).push(arguments)
            };
        ga('require', 'ecommerce', 'ecommerce.js');   //固定引用ecommerce.js
        ga('ecommerce:addTransaction', {   //收集订单数据
            'id': '{{orderNum}}',                     // Transaction ID. Required.
            'affiliation': 'YOHOBUY',   // Affiliation or store name.
            'revenue': '{{count}}',               // Grand Total.
            'shipping': '1.0', //	Shipping.
            'tax': '0' // Tax.
        });
        {{#orderGoods}}
        ga('ecommerce:addItem', {   //收集商品数据
            'id': '{{../orderNum}}',                     // Transaction ID. Required.
            'name': '{{product_name}}',    // Product name. Required.
            'sku': '{{product_sku}}',                 // SKU/code.
            'category': 'Olive Medium',         // Category or variation.
            'price': '{{goods_price}}',                 // Unit price.
            'quantity': '{{buy_number}}'                   // Quantity.
        });
        {{/orderGoods}}
        ga('ecommerce:send');  //发送电子商务跟踪数据
        ga('myTracker.ecommerce:send');
    </script>

    <script src="//static.yohobuy.com/js/AG_Tracking.js?v=20121102"></script>
    <script type="text/javascript">
        //请将js代码嵌入到html中body标签结束之前。(整个body部分最后边)
        var _agq = _agq || [];
        _agq.push(['_cid', '415']); //生成value
        _agq.push(['_eid', '102']); //生成value
        //以下参数需要客户配合填写。**为需要替代内容
        _agq.push(['_orderSum', '{{count}}']);//订单金额,客户在页面填写
        _agq.push(['_orderNo', '{{orderNum}}']);//订单号,客户在页面填写
        _agq.push(['_orderNew','{{#if isOldUser}}false{{else}}true{{/if}}']);//是否新客单,客户标记是为true否为false
        _agq.push(['_orderCount', '{{ordersGoodsNums}}']);//订单货品数目,客户填写
        ag_send(_agq);

        var __order_code = '{{orderNum}}';
        var __order_amount = '{{count}}';
        var __order_user = '{{#if isOldUser}}old{{else}}new{{/if}}';
        var __order_uid = '{{uid}}';
        var __order_goods_num = {{ordersGoodsNums}};
        var __order_goods = JSON.stringify({{goodsData}});
    </script>
    <script type="text/javascript">
        var _mvq = window._mvq || [];
        window._mvq = _mvq;
        _mvq.push(['$setAccount', 'm-23428-1']);
        _mvq.push(['$setGeneral', 'ordercreate', '', /*用户名*/ '', /*用户id*/ '{{uid}}']);
        _mvq.push(['$logConversion']);
        _mvq.push(['$addOrder', /*订单号*/ '{{orderNum}}', /*订单金额*/ '{{count}}']);
        _mvq.push(['$logData']);
    </script>
{{/if}}