butterandfly / project_9

Blog & Remark
0 stars 0 forks source link

落地页添加检测代码 #247

Open butterandfly opened 9 years ago

butterandfly commented 9 years ago

head之前需要添加:

  <script type="text/javascript">
    (function() {
      window._CiQ10081 = window._CiQ10081 || [];
      window._CiQ10081.push(['_cookieUseRootDomain', true]);
      var c = document.createElement('script');
      c.type = 'text/javascript';
      c.async = true;
      c.charset = 'utf-8';
      c.src = '//dna.biddingx.com/ca/10081';
      var h = document.getElementsByTagName('script')[0];
      h.parentNode.insertBefore(c, h);
    })();
  </script>
  <!-- Tag Manager -->
  <script>
    (function(a, b, c, d, e, f) {
      a[d] = a[d] || [];
      var g = a[e] = a[e] || {};
      a.tagmangerGlobalObject = e, g[f] = {dlName: d};
      var h = b.getElementsByTagName(c)[0], i = b.createElement(c);
      i.async = !0, i.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://static') + '.tagmanager.cn/boot/' + f + '.js', h.parentNode.insertBefore(i, h)
    })(window, document, 'script', 'TGDataLayer', 'tagmanager', 10087);
  </script>
  <!-- End Tag Manager -->
butterandfly commented 9 years ago

添加___log方法:

  function ___log(label) {
    /* 请将 LabelValue 与 Value 替换为对应字段的取值 */
    window._CiQ10081 = window._CiQ10081 || [];
    window._CiQ10081.push(['_trackEvent', {
      type: 1,
      labels: [{'按钮名称': label}],
      values: [{'数量': 1}]
    }]);
    window.CClickiV3 && window.CClickiV3[10081] && window.CClickiV3[10081]._flushObserver(function () {
    });
  }
butterandfly commented 9 years ago

注册执行时调用:

  window._CiQ10081 = window._CiQ10081 || [];
  window._CiQ10081.push(['_trackEvent', {
    type: 2,
    labels: [
      {'入住时间': enterTime}
      , {'离开时间': leaveTime}
      , {'房型': roomstyle}
      , {'房间数': roomcount}
      , {'预定人': name}
      , {'手机': phone}
      , {'是否吸烟': smoke}
      , {'特殊要求': askfor}
      , {'总价': amountJq.text()}
    ],
    values: [
      {'数量': 1}
    ]
  }]);
  window.CClickiV3 && window.CClickiV3[10081] && window.CClickiV3[10081]._flushObserver(function () {
    _CWiQ.push(['_trackReg', 1]);
    ___log('submit');
    alert('预约成功!');
  });