box-buy-analysis.hbs 2.84 KB
{{#if order_goods}}
    <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': '{{order_code}}',                     // Transaction ID. Required.
            'affiliation': 'YOHOBUY',   // Affiliation or store name.
            'revenue': '{{payment_amount}}',               // Grand Total.
            'shipping': '1.0', //	Shipping.
            'tax': '0' // Tax.
        });
        {{#order_goods}}
        ga('ecommerce:addItem', {   //收集商品数据
            'id': '{{../order_code}}',                     // 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.
        });
        {{/order_goods}}
        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', '{{payment_amount}}']);//订单金额,客户在页面填写
        _agq.push(['_orderNo', '{{order_code}}']);//订单号,客户在页面填写
        _agq.push(['_orderNew','{{#if isOldUser}}false{{else}}true{{/if}}']);//是否新客单,客户标记是为true否为false
        _agq.push(['_orderCount', '{{ordersGoodsNums}}']);//订单货品数目,客户填写
        ag_send(_agq);

        var __order_code = '{{order_code}}';
        var __order_amount = '{{payment_amount}}';
        var __order_user = '{{#if isOldUser}}old{{else}}new{{/if}}';
        var __order_uid = '{{uid}}';
        var __order_goods_num = '{{ordersGoodsNums}}';
        var __order_goods = '{{goodsDatas}}';
    </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', /*订单号*/ '{{order_code}}', /*订单金额*/ '{{payment_amount}}']);
        _mvq.push(['$logData']);
    </script>
{{/if}}