It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

google analytics on confluence pages

Can we gather analytics (via Google) on Confluence usage by pasting the javascript below into the page template header for any pages we want to track.

Can I do this within Confluence?

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35048994-1']);
  _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>

7 answers

1 accepted

8 votes
Answer accepted

Yes, you can perform it within Confluence. Please, refer to the following path:

Browse > Confluence Admin > 'Look and Feel' - Custom HTML > Edit

Through this page, insert your javascript where you want. In this case, at 'end of the HEAD'.

Kind Regards

Interesting.. i will try this way.

Thanks, Srinivas

Does this need to have the AJS.toInit included before the function in the JavaScript to make it work in Confluence?

Does this work on a space level?

 

I am only interested in tracking the one space not all.

You can apply it universally in Confluence, then within Analytics you can set up a view that shows only the analytics for a particular space by providing the URL.

Thanks all!

  1. Does this apply to Confluence Cloud?
  2. Should this be done manually with all Confluence URLs that need to be tracked?

 

 

David Simpson Community Leader Jun 06, 2017

@federico This is for Confluence Server only, where you can add custom JavaScript.

For Confluence Cloud, this is not possible, so you'll need to use an add-on such as:

Like 1 person likes this

I just downloaded your product, working fine so far! Thanks, David.

Like 1 person likes this

Also you can check this plugin:

https://marketplace.atlassian.com/plugins/me.davidsimpson.confluence.plugins.googleanalytics

This plugin displays reports for an external Confluence website, or a particular space...please check if this plugin suits for you.

Yes. I already tried that. This requires a license though :)

Go to:

  • Global Administration
  • Custom HTML
  • At the end of HEAD
  • Paste your script.

It works pretty well, I'm sure ;)

Hi Srinivas, Please tick the right answer if it worked for you. Thanks!

All,

We have enabled google analytics and I would like to get metrics (page views and duration etc) on a specific confluence page and email to a particular user group.

Note: I'm not looking for a paid solution. The videos out there are old or specific to paid solution.

Thanks in advance

Udhay

Hi! I want to do this only for one space. I go to Browse>Space Admin>Look and Feel>Themes>Configure theme>Messages>Header and enter the script there using the {html} macro (we're on conf 3.5).

However, Conf removes the leading bracket from <script>, and removes the closing tag </script> altogether. I even tried making a custom macro {html-script}, but the result is the same. Adding the script to an individual page works ok.

Please help!

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted an hour ago in Jira

Upcoming Enterprise releases targeting Q3 2019: Jira Software 8.5 & Jira Service Desk 4.5

Since launching the Jira Software 8.0 and Jira Service Desk 4.0 platform releases in February, many of you have been asking when the next Enterprise release will be so you can take advantage of the m...

154 views 0 2
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