재우니의 블로그

 

http://도메인?analy=1000 이런식으로 들어오면 자바스크립트로 파싱해서 piwik 에서 처리한다.

<script>
        var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;

for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');

if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};

        $(function () {
         var analy = getUrlParameter('analy');
         //alert(analy); //10001

             if (analy != undefined)
             {
                 var eventName = "";

                 switch(analy){
                     case "1000" :
                     eventName = "서담(서강대)";
                     break;
                     case "1001" :
                     eventName = "성대사랑(성대)";
                     break;
                     case "1002" :
                     eventName = "쿵(건대)";
                     break;
                     case "1003" :
                     eventName = "홍익인(홍대)";
                     break;
                     case "1004" :
                     eventName = "스노로즈(숙대)";
                     break;
                     case "1005" :
                     eventName = "에브리타임";
                     break;
                     case "1006" :
                     eventName = "아이캠펑";
                     break;
                     case "1007" :
                     eventName = "연세대(세연넷)";
                     break;
             }

             _paq.push(['trackEvent', '외부접속통계', eventName, '']);
         }
        });
    </script>