Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to configure Google Analytics to Confluence?

Rumceisz May 24, 2012

Hi All,

I'd like to install Google Analytics to our Confluence. We would like to track the number of page visitor for each page.

Can you please help?

Thanks in advance!

Rumi

3 answers

1 accepted

5 votes
Answer accepted
Christian Neureiter-Schneider May 24, 2012

Adminstration Console > Look and Feel > Custom HTML > At end of the head > Paste your google analytics code there which you get when creating your analytics account

Example:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'ABCDEFGHIJK']);
  _gaq.push(['_trackPageview']);

  (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);
  })();

</script>

Rumceisz May 30, 2012

Hi David,

I insterted the script generated by my analytics account. But how can I set the page view tracking for each page in a particular space? I never used Google Analytics before, so can you please help me where to setting this?

Many thanks!

Rumi

1 vote
Dennis May 5, 2017

I know it's an old post but I would recommend piwik.org - as piwik is open source and on prem it's the best choice. BR! Dennis

0 votes
David at David Simpson Apps
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 29, 2012

A couple of answers:

For Confluence Server: 
Use the Google Analytics for Confluence plugin which takes care of the tracking code installation and enables Google Analytics reporting to be displayed within Confluence

Additionally, I wrote a blogpost here which suggests adding the following to the Custom HTML:

<script>
  // Standard Google Universal Analytics code
  (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','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-XXXX-Y', 'auto'); // TODO: Update with valid GA tracking code
  ga('send', 'pageview');
</script>

For Confluence Cloud:
Try out the Google Analytics in Confluence (Cloud) add-on.

 

 

Rumceisz May 29, 2012

Hi David,

is there a feature which doesn't need Google Analytics for Confluence plugin? Hence, my users don't want to pay for the plugin.

Thanks,

Rumi

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events