91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

js 追蹤腳本

發布時間:2020-08-11 08:36:09 來源:網絡 閱讀:802 作者:濤石 欄目:web開發
js 追蹤腳本
lk_t.js
var LK = {
  version:"1.0",
  host:"",
  key:"LK",
  expire_days:3600,
  cmds:[],
  tracker:function()
  {
    var that = this.tracker;
    that.timestamp = this.getTimestamp();
    that.prop = {};
    //發送請求
    that.log = function (param){
      var img = new Image(1, 1);
      img.onLoad = function (){};
      img. LK.buildUrl(param);
    };
  },
  //處理命令隊列
  submit:function()
  {
    this.tracker();
    for(var i in this.cmds)
    {
      line = this.cmds[i];
       //call和apply,它們的作用都是將函數綁定到另外一個對象上去運行
      //Array.prototype.slice這句就是訪問Array的內置方法
      var args = Array.prototype.slice.call(line, 1);
      if(!window[this.key])
        window[this.key] = this;
      window[this.key][line[0]].apply(this.tracker, args);
    }
  },
  setSiteId:function(siteid)
  {
    this.siteid = siteid;
  },
  //跟蹤PV
  trackPageView:function()
  {
    this.log('');
  },
  //訂單數據
  addTransaction:function (order_id, order_source, total, tax, shipping, gateway, city, state, country)
  {
    if(!this.prop.trans)
      this.prop.trans = {};
    
    var trans = {};
    trans.order_id = order_id;
    trans.order_source = encodeURIComponent(order_source);
    trans.total = total;
    trans.tax = tax;
    trans.shipping = shipping;
    trans.gateway = encodeURIComponent(gateway);
    trans.city = encodeURIComponent(city);
    trans.state = encodeURIComponent(state);
    trans.country = encodeURIComponent(country);
    trans.items = [];
    this.prop.trans[order_id] = trans;    
  },
  //產品數據
  addTransactionLineItem:function (order_id, sku, product_name, category, unit_price, quantity)
  {
    var li = {};
    li.li_order_id = order_id;
    li.li_sku = encodeURIComponent(sku);
    li.li_product_name = encodeURIComponent(product_name);
    li.li_category = encodeURIComponent(category);
    li.li_unit_price = encodeURIComponent(unit_price);
    li.li_quantity = quantity;
    var order = this.prop.trans[order_id];
    var items = order['items'];
    items.push(li);
    order['items'] = items;
    this.prop.trans[order_id] = order;
  },
  trackTransaction:function()
  {
    var param = "";
    for(var o in this.prop.trans)
    {
      for(var k in this.prop.trans[o])
      {
        var v = this.prop.trans[o][k];
        if(typeof v === 'object')
          for(var t in v)
            for(ta in v[t])
              param += "&" + ta + "=" + v[t][ta];
        else
          param += "&" + k + "=" + v;
      }
    }
    this.log(param);
  },
  //構建URL
  buildUrl:function (param)
  {
    var that = this.tracker;
    var url = "";
    url += this.host;
    url += "?siteid=" + that.siteid;
    url += "&visitor_id=" + this.getVisitorId();
    url += "&page_title=" + this.getPageTitle();
    url += "&tourl=" + this.getUrl();
    url += "&referrer=" + this.getReferrer();
    url += param;
    url += "&version=" + this.version;
    return url;
  },
  setCookie:function (name, value, days, path, domain, secure)
  {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    var domain_arr = location.hostname.split('.');
    
    if(domain_arr.length == 2)
      domain = location.hostname;
    else    
    {
      domain_arr.shift();
      domain = "." + domain_arr.join('.');
    }    
    document.cookie = name + "=" + escape(value) +
      ((days) ? "; expires=" + date.toGMTString() : "") +
      "; path=/"    +
      "; domain=" + domain +
      ((secure) ? "; secure" : "");
  },
  readAllCookies : function ()
  {
    var jar = {};
    var ca = document.cookie.split(';');
    if (ca) {
      for (var i = 0; i < ca.length; i++) {
        var cat = this.util.trim(ca[i]);
        var pos = this.util.strpos(cat, '=');
        var key = cat.substring(0, pos);
        var value = cat.substring(pos + 1, cat.length);
        if (!jar.hasOwnProperty(key)) {
          jar[key] = [];
        }
        jar[key].push(value);
      }
      return jar;
    }
  },
  getCookie : function (name)    
  {
    var jar = this.readAllCookies();
    if (jar) {
      if (jar.hasOwnProperty(name)) {
        return jar[name][0];
      } else {
        return "";
      }
    }
  },
  getTimestamp:function()
  {
    return Math.round(new Date().getTime() / 1000);
  },
  getVisitorId:function()
  {
    
    var visitorId = this.getCookie("lk_vuid");
    if(visitorId)
    {
      return visitorId;
    }
    else
    {
      var time = new Date().getTime();
      var random = Math.round(Math.random() * 1000000);
      visitorId = time + "" + random;
      this.setVisitorId(visitorId);
      return visitorId;
    }
  },
  setVisitorId:function(visitorId)
  {
    this.setCookie('lk_vuid', visitorId, this.expire_days);
  },
  getPageTitle:function()
  {
    try {
                                var t = document.getElementsByTagName("title");
                                return encodeURIComponent(t[0].text);
                } catch (e) {return "";}
    //var t = document.getElementsByTagName("title");
    //return t == null ? encodeURIComponent(t[0].text) : '';
  },
  getUrl:function()
  {
    //訪問 URL
    var tourl = location.href;
    return encodeURIComponent(tourl);
  },
  getReferrer:function()
  {
    //來源URL
    var referrer = document.referrer;
    return encodeURIComponent(referrer);
  },
  util:{
    trim:function(str)
    {
      return str.replace(/(^\s+)|(\s+$)/, '');
    },
    strpos:function(haystack, needle, offset)
    {
      var i = (haystack + '').indexOf(needle, (offset || 0));
      return i === -1 ? false : i;
    }
  }
};

(function(){
  var lk = LK;
  lk.host = "http://192.168.3.250/__lk.gif";
  if(lk_cmds)
    lk.cmds = lk_cmds;
    
  lk.submit();
})();    
 
其中
//處理命令隊列 
  
submit:function()    
    {    
        this.tracker();    
        for(var i in this.cmds)    
        {    
            line = this.cmds[i];    
            //Array.prototype.slice這句就是訪問Array的內置方法    
            var args = Array.prototype.slice.call(line, 1);    
            if(!window[this.key])    
                window[this.key] = this;    
            window[this.key][line[0]].apply(this.tracker, args);    
        }    
 
Array.prototype.slice這句就是訪問Array的內置方法
 
相關信息查看  JS 有趣的應用 : Array.prototype.slice.call(arguments,0)
 
基本統計代碼:
<!-- Start LK Wise Attribution System Tracker -->
<script type="text/javascript">
//<![CDATA[
var lk_cmds =[];
lk_cmds.push(['setSiteId', 'Y8CG26ZF']);
lk_cmds.push(['trackPageView']);
(function() {
  var _lk = document.createElement('script'); _lk.type = 'text/javascript'; _lk.async = true;
        _lk.src = 'http://www.zikker.com/lk_t_compress.js';
        var _lk_s = document.getElementsByTagName('script')[0]; _lk_s.parentNode.insertBefore(_lk, _lk_s);
}());
//]]>
</script>
<!-- End LK Wise Attribution System Code -->
 
訂單統計代碼
下面紅色標識部分是您需要針對自己的訂單進行修改的部分,參數含義如下
訂單數據addTransaction: order_id(訂單號), order_source(訂單來源), total(訂單金額[總和]), tax(稅), shipping(運費), gateway(途徑), city(城市), state(省), country(國家)
產品數據addTransactionLineItem: order_id(訂單號), sku(產品SKU[品牌]), product_name(產品名稱), category(各類,類別), unit_price(單價), quantity(購買產品數量)
 


<script type="text/javascript">
//<![CDATA[
var lk_cmds = lk_cmds || [];
lk_cmds.push(['setSiteId', 'Y8CG26ZF']);
lk_cmds.push(['addTransaction','order_id', 'order_source', 'total', 'tax', 'shipping', 'gateway', 'city', 'state', 'country']);
lk_cmds.push(['addTransactionLineItem','order_id', 'sku', 'product_name', 'category', 'unit_price', 'quantity']);
lk_cmds.push(['trackTransaction']);

(function() {
var _lk = document.createElement('script'); _lk.type = 'text/javascript'; _lk.async = true;
_lk.src = 'http://192.168.3.250/lk_t_compress.js';
var _lk_s = document.getElementsByTagName('script')[0]; _lk_s.parentNode.insertBefore(_lk, _lk_s);
}());
//]]>
</script>
 
 
使用示例:
利用Javasctipt方式進行跟蹤, 復制以下代碼,粘貼到您的HTML頁面中用來跟蹤您的網站頁面的流量。Javascript 跟蹤API 跟蹤您的網站和網頁流量
<!-- Start LK Wise Attribution System Tracker -->
<script type="text/javascript">
//<![CDATA[
var lk_cmds = lk_cmds || [];
lk_cmds.push(['setSiteId', 'Y8CG26ZF']);
lk_cmds.push(['trackPageView']);
(function() {
                var _lk = document.createElement('script'); _lk.type = 'text/javascript'; _lk.async = true;
        _lk.src = 'http://192.168.3.250/lk_t.js';
        var _lk_s = document.getElementsByTagName('script')[0]; _lk_s.parentNode.insertBefore(_lk, _lk_s);
}());
//]]>
</script>
<!-- End LK Wise Attribution System Code -->

<script type="text/javascript">
//<![CDATA[
var lk_cmds = lk_cmds || [];
lk_cmds.push(['setSiteId', 'Y8CG26ZF']);
lk_cmds.push(['addTransaction','123', 'baidu.com', '222', '15', '10', '快遞', '北京', '北京', '中國']);
lk_cmds.push(['addTransactionLineItem','123', '九陽', '壓力鍋', '壓力鍋', '222', '1']);
lk_cmds.push(['trackTransaction']);

(function() {
var _lk = document.createElement('script'); _lk.type = 'text/javascript'; _lk.async = true;
_lk.src = 'http://192.168.3.250/lk_t.js';
var _lk_s = document.getElementsByTagName('script')[0]; _lk_s.parentNode.insertBefore(_lk, _lk_s);
}());
//]]>
</script>
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

安塞县| 涟源市| 永济市| 尉犁县| 浮梁县| 威信县| 太白县| 马关县| 乐陵市| 寻乌县| 桐庐县| 沙河市| 贵州省| 昌邑市| 永修县| 莫力| 项城市| 荥阳市| 视频| 柘城县| 孟连| 洛阳市| 汉中市| 黑龙江省| 东安县| 东方市| 阳原县| 瑞安市| 西华县| 莒南县| 泰和县| 仙游县| 永康市| 盐山县| 福海县| 观塘区| 宜川县| 南乐县| 广水市| 五大连池市| 婺源县|