• Web Tracking


    采集方式_数据采集_用户指南_日志服务-阿里云 https://help.aliyun.com/document_detail/28981.html

    http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/31752/cn_zh/1462870126706/loghub-tracking.js?spm=a2c4g.11186623.2.15.6cc3420bKTvBvV&file=loghub-tracking.js 

    (function(window, document){
        function createHttpRequest()
        {
            if(window.ActiveXObject){
                return new ActiveXObject("Microsoft.XMLHTTP");  
            }
            else if(window.XMLHttpRequest){
                return new XMLHttpRequest();  
            }  
        }
        function AliLogTracker(host,project,logstore)
        {
            this.uri_ = 'http://' + project + '.' + host + '/logstores/' + logstore + '/track?APIVersion=0.6.0';
            this.params_=new Array();
            this.httpRequest_ = createHttpRequest();
        }
        AliLogTracker.prototype = {
            push: function(key,value) {
                if(!key || !value) {
                    return;
                }
                this.params_.push(key);
                this.params_.push(value);
            },
            logger: function()
            {
                var url = this.uri_;
                var k = 0;
                while(this.params_.length > 0)
                {
                    if(k % 2 == 0)
                    {
                        url += '&' + encodeURIComponent(this.params_.shift());
                    }
                    else
                    {
                        url += '=' + encodeURIComponent(this.params_.shift());
                    }
                    ++k;
                }
                try
                {
                    this.httpRequest_.open("GET",url,true);
                    this.httpRequest_.send(null);
                }
                catch (ex) 
                {
                    if (window && window.console && typeof window.console.log === 'function') 
                    {
                        console.log("Failed to log to ali log service because of this exception:
    " + ex);
                        console.log("Failed log data:", url);
                    }
                }
                
            }
        };
        window.Tracker = AliLogTracker;
    })(window, document);



  • 相关阅读:
    JFreeChart API 说明(转)
    杭电1064
    杭电2734
    杭电1170
    杭电1197
    杭电2629
    杭电1062
    杭电2088
    杭电1205
    杭电1004
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9796052.html
Copyright © 2020-2023  润新知