2013-02-12 1 views
0

는 누군가가 나 다음 링크에서 프로세스, onclick을 내 특히 일부 이해하는 데 도움이 될 수 있습니다 :this.href.substr (23)이 GA로 이벤트 traking 프로세스를 수행하는 이유는 무엇입니까?

<a href="http://www.example.com/files/download/files.php?file=my_file.doc" onClick="_gaq.push(['_trackEvent', 'Downloads', 'DOC', this.href.substr(23)]); fn12_reminder(this,''); return false;" rel="nofollow"> 

나는이 간단한 GA도 추적 과정은 이해를하지만 내가 이해할 수없는 것은 내가 할 수없는 마지막 부분 this.href.substr(23)입니다 이것이 전체 프로세스에서 실제로 무엇을하는지 파악하십시오.

헤더에 장착 된 JS 스크립트는 다음과 같은 특성 (경험이있는 사람이 연결을 발견 할 수 있도록 존재하는 경우 나, 전액을 게시하고)이다 :

var functions = true; 
function fn12_custom_display_notice(theNotice,theClass){ 
    if(theClass!=''){ 
     jQuery("#user-notice").removeClass(); 
     jQuery("#user-notice").addClass(theClass); 
     } 
     jQuery("#user-notice").html(theNotice).animate({width:'toggle'},250).delay(3000).animate({width:'toggle'},250); 
     } 
function fn12_custom_display_reminder(theHTML,theDownloadLink){if(typeof jQuery.ui!='undefined'){$("#dialog").attr("title","Please help spread the word").html(theHTML);$("#dialog").dialog({modal:true,width:375,buttons:{"Continue to Download":function(){$(this).dialog("close");window.location=theDownloadLink;}}});}else{window.location=theDownloadLink;}} 
function fn12_custom_reminder(aelem,topic){theLink=$(aelem).attr("href");$.ajax({type:"POST",url:"/db/ajax.php",data:"action=reminder&thepath="+theLink+"&topic="+topic,dataType:"json",error:function(){window.location=theLink;},success:function(msg){if(msg.status==1)fn12_custom_display_reminder(msg.html,theLink);else{fn12_custom_display_notice(msg.message,"error");}}});} 
function fn12_custom_gplus_callback(theObject){if(theObject.state=='on'){fn12_custom_display_notice("Big thanks!!!",'success');}} 

/* jquery_cookie.js Copyright (c) 2006 Klaus Hartl (stilbuero.de), Dual licensed under the MIT and GPL licenses */ 
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'||(name&&typeof name!='string')){if(typeof name=='string'){options=options||{};if(value===null){value='';options.expires=-1;} 
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;} 
expires='; expires='+date.toUTCString();} 
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=name+'='+encodeURIComponent(value)+expires+path+domain+secure;}else{for(var n in name){jQuery.cookie(n,name[n],value||options);}}}else{var returnValue={};if(document.cookie){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(!name){var nameLength=cookie.indexOf('=');returnValue[cookie.substr(0,nameLength)]=decodeURIComponent(cookie.substr(nameLength+1));}else if(cookie.substr(0,name.length+1)==(name+'=')){returnValue=decodeURIComponent(cookie.substr(name.length+1));break;}}} 
return returnValue;}}; 

어떤 도움은 매우입니다 appriciated

답변

1

예에서 this.href.substr(23)files/download/files.php?file=my_file.doc과 같습니다. 이는 단순히 a 요소와 연결된 URL입니다.

  • this 현재 개체의 a 요소를 지칭한다.
  • href은 요소의 속성을 나타냅니다.
  • substr(23)은 프로토콜과 도메인 이름을 제거하기 위해 23 번째 문자로 시작하는 부분 문자열을 사용합니다.
+0

빠른 응답을 보내 주셔서 감사합니다. 다음 질문은 내가 게시 한 js 스크립트와 관련이 있는지 여부입니다. – AlexB

+0

게시하기 전에 전체 답변을 보지 않았으므로 이제 모든 내용이 수정되었습니다. – AlexB

관련 문제