1
|
|
String.prototype.startsWith=function(a){return this.indexOf(a)==0};String.prototype.endsWith=function(a){return this.lastIndexOf(a)==this.length-a.length};(function(d){var f=0;var b={attributes:[],assignTo:["a","input[type='submit']"],captureOnce:false,client:null,exclude:".analytics-exclude",url:null};function a(i){var g=[];var h=d(i).prop("tagName");if(h!=undefined){var k=d(i).parent();if(k!=undefined){d.each(a(d(i).parent()),function(l,m){g.push(m)})}if(h=="HTML"||h=="BODY"){g.push(h)}else{var j=d(i).analyticsUniqueId().attr("id");g.push(h+'[id="'+j+'"]')}}return g}function c(g){a(g)}function e(k){$this=d(this);if(b.url&&!$this.is(".analytics-captured")&&!$this.is(b.exclude)){var j={id:a($this).join(" ")};if(b.client){j.client=b.client}var i=$this.data();for(var h in i){if(h.startsWith("analytics")){var g=h.replace(/analytics/g,"").toLowerCase();j[g]=i[h]}}d.each(d(b.attributes),function(l,m){j[m]=$this.attr(m)});d.ajax({type:"POST",url:b.url,contentType:"application/x-www-form-urlencoded",data:j}).always(function(){if(b.captureOnce){$this.addClass("analytics-captured")}})}}d.fn.analyticsUniqueId=function(){if(this.length==0){return}return this.each(function(){if(!d(this).attr("id")){d(this).attr("id","analytics-id-"+ ++f)}})};d.fn.analytics=function(h){if(d(this).length==0){return}b=d.extend({},b,h);var g=b.assignTo.join(",");return this.each(function(){d(this).find(g).andSelf().filter(g).each(function(){c(d(this));d(this).on("click",e)})}).on("DOMNodeInserted",function(i){d(i.target).find(g).andSelf().filter(g).each(function(){c(d(this));d(this).on("click",e)})})}})(jQuery);
|
|
1
|
String.prototype.startsWith=function(a){return this.indexOf(a)==0};String.prototype.endsWith=function(a){return this.lastIndexOf(a)==this.length-a.length};(function(d){var f=0;var b={attributes:[],assignTo:["a","input[type='submit']"],captureOnce:false,client:null,id:"id",exclude:".analytics-exclude",url:null};function a(i){var g=[];var h=d(i).prop("tagName");if(h!=undefined){var k=d(i).parent();if(k!=undefined){d.each(a(d(i).parent()),function(l,m){g.push(m)})}if(h=="HTML"||h=="BODY"){g.push(h)}else{var j=d(i).analyticsUniqueId().attr("id");g.push(h+'[id="'+j+'"]')}}return g}function c(g){a(g)}function e(m){$this=d(this);if(b.url&&!$this.is(".analytics-captured")&&!$this.is(b.exclude)){var l=null;if($this.attr("href")){m.preventDefault();l=$this.attr("href")}var k={};var g=a($this).join(" ");if(b.id){k[b.id]=g}else{k.id=g}if(b.client){k.client=b.client}var j=$this.data();for(var i in j){if(i.startsWith("analytics")){var h=i.replace(/analytics/g,"").toLowerCase();k[h]=j[i]}}d.each(d(b.attributes),function(n,o){k[o]=$this.attr(o)});d.ajax({type:"POST",url:b.url,contentType:"application/x-www-form-urlencoded",data:k}).always(function(){if(b.captureOnce){$this.addClass("analytics-captured")}if(l){window.location=l}})}}d.fn.analyticsUniqueId=function(){if(this.length==0){return}return this.each(function(){if(!d(this).attr("id")){d(this).attr("id","analytics-id-"+ ++f)}})};d.fn.analytics=function(h){if(d(this).length==0){return}b=d.extend({},b,h);var g=b.assignTo.join(",");return this.each(function(){d(this).find(g).andSelf().filter(g).each(function(){c(d(this));d(this).on("click",e)})}).on("DOMNodeInserted",function(i){d(i.target).find(g).andSelf().filter(g).each(function(){c(d(this));d(this).on("click",e)})})}})(jQuery);
|