수색…


Google 웹 로그 분석은 코드가 없으며 플러그인이 필요 없습니다.

index.js 내에 analytics 함수를 삽입하십시오.

    function analytics(){

        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','lib/analytics.js','ga');
    
        if(window.localStorage) {
    
            ga('create', 'UA-XXXXXXX-1', {
              'storage': 'none'
              , 'clientId': window.localStorage.getItem('ga_clientId')  /*The tracker id obtained from local storage*/
            });
            ga(function(tracker) {
              window.localStorage.setItem('ga_clientId', tracker.get('clientId'));
             /*The tracker id for each device is different and stored in local storage*/
            });
        }
        else {
    
            ga('create', 'UA-XXXXXXX-1', 'auto');
        }

    }

각 HTML 페이지에 아래의 각 스크립트 태그를 삽입하고 페이지 이름을 수정하십시오.

    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','lib/analytics.js','ga');
        
        ga('set','checkProtocolTask',null); 
        /*checkProtocal Task is set to null so that GA allows tracking other than http/https */
        
        ga('set', 'page', "Page Name");
        /*Page Name is name of each html page*/
        
        ga('send', 'pageview');
    </script>


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow