How to configure Google Analytics to Confluence?

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!


3 answers

1 accepted

This widget could not be displayed.

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


<script type="text/javascript">

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

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


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!


This widget could not be displayed.

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:

  // Standard Google Universal Analytics code
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  ga('create', 'UA-XXXX-Y', 'auto'); // TODO: Update with valid GA tracking code
  ga('send', 'pageview');

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



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.



This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

370 views 2 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you