Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

...

You can use Google Analytics natively be inserting a small script in the "Custom HTML" on the admin pages:

 

code
UI Expand
titleGoogle Analytics script
Kodeblok
</script>
<!--GOOGLE-ANALYTICS-PLUGIN-START-->
<!-- Updated: 2015-08-18 20:20:29 -->
<script type="text/javascript">
    // Disable any trackers that Atlassian may have added
    for (i=0; i < 50; i++) {  // normally it's 14, but let's use a hammer to kill any new ones too.
        window['ga-disable-UA-20272869-'+i] = true;
    }
    var _gaq = _gaq || [];
    _gaq.push(['af._setAccount', 'UA-XXXXXXXX-1']); 

    AJS.toInit(function(){
        // set custom variables
        setCustomVarSpaceKey(); 
        setCustomVarUserKey();  
        if (typeof AJS.params.pageId === 'string') {
            _gaq.push(
                    ['af._setCustomVar', 3, 'confluence-page-id', AJS.params.pageId, 3 ],             
                    ['af._setCustomVar', 4, 'confluence-content-type', AJS.params.contentType, 3 ],   
                    ['af._set', 'title', AJS.params.pageTitle]                                        
            );
        }
        // track page view
        _gaq.push(['af._trackPageview']); 

        AJS.$("a[href*='/download/attachments/']").click(function(event) { 
            event.preventDefault();
            var pageIdAttachmentName = this.pathname.substring(this.pathname.indexOf('/download/attachments/') + 23);
            var parts = pageIdAttachmentName.split('/');
            // set custom variables
            setCustomVarSpaceKey(); 
            setCustomVarUserKey();  
            _gaq.push(
                    ['af._setCustomVar', 3, 'confluence-page-id', parts[0], 3 ],            
                    ['af._setCustomVar', 4, 'confluence-content-type', 'attachment', 3 ],   
                    ["af._set", "title", decodeURIComponent(parts[1])],                     
                    ['af._setReferrerOverride', location.href]                              
            );
            var attachmentUrl = AJS.$(this).attr('href');

            // track page views
            _gaq.push(['af._trackPageview', attachmentUrl]);

            setTimeout(function() { document.location.href = attachmentUrl; }, 500);
        }); 

        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    });

    function setCustomVarSpaceKey() {
        if (typeof AJS.params.spaceKey === 'string') {
            _gaq.push(['af._setCustomVar', 1, 'confluence-space-key', AJS.params.spaceKey, 3 ]); 
        }
    }
    function setCustomVarUserKey() {
        if (typeof AJS.params.userKey === 'string') {
            _gaq.push(['af._setCustomVar', 2, 'confluence-user-key', AJS.params.userKey, 1 ]);        
        }
    }

</script>
<!--GOOGLE-ANALYTICS-PLUGIN-END-->

 

 

Or use a plugin to embed Google Analytics pages in Confluence. Look at AppFusion and at Tracking Atlassian Confluence usage with Google Analytics

What Comment
Timestamp(afkryds) 
Remote IP(afkryds) 
Username(afkryds) Extracted by the Script and hashed
Spacename(afkryds)Extracted by the Script
Pagename(afkryds) Extracted by the Script
URL(afkryds) 
Return HTTP Code(afkryds) 
Responsetime(afkryds) 
UserAgent(afkryds) 

...