You’ve chosen Confluence as your Enterprise wiki and got it installed. People are using it. But how many people?
You could have a look at the Global Activity page on Confluence, but this might confuse matters.
You’ll get to see graphs, but what do they really mean? The Global Activity statistics are at best very basic.
Better still, install Google Analytics and you’ll have a much more accurate idea of what’s going on. Best of all, it’s really easy to install.
How to install Google Analytics on Confluence
I’m assuming (for my sake) that you already know your way around Google Analytics.
In Google Analytics
Login to Google Analytics and add a new website profile
The settings will roughly mirror those in the screenshot below
Make sure that you check “Do Track Site Search” against Site Search. Add queryString as the Query Parameter. This will allow you to monitor who is searching for what.
Update (2009-11-12)
Edit the Search Settings configuration like in the image to see search terms grouped by spaceKey in the internal search categories reports. Further details why can be seen here
The top search terms will suggest either content that’s missing from the site, or something that is not easily found in the current information architecture. Either way, tracking this and acting on the findings should improve the user experience.
In Confluence
Login to Confluence as an administrator and add the GA tracking javascript code to the end of the page body…
Navigate to:
Dashboard | Administration | Look and Feel | Custom HTML
Click on the “Edit” button and add the javascript sample (with your tracker code) to the “At end of the BODY” section:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try
{
var pageTracker = _gat._getTracker("UA-XXXXXX-X");
pageTracker._trackPageview();
}
catch(err)
{}
</script>
Results
We’ve not had this running long, but it seems to work just fine. As Confluence creates pages with distinct titles, its fairly easy to track how people are using the system.
Screenshot of Content by Title report:

Screenshot of Site Search Terms report:






Comments
8 Comments so far. Leave a comment below.are there any firewall issues as alluded to on this Atlassian page:
How to audit Confluence – enabling user access logging ?
thanks, steve
Steve: If the client browser has free access to the internet, then there should be no problem. It’s the client browser which is loading the ga.js JavaScript directly from Google’s servers.
If however you’re a closed network, you’re definitely out of luck here. If this applies, you could of course buy a copy of Urchin and host it locally
Any thoughts on how to upgrade when you’ve used this technique to add Analytics to your site? Does the custom html stick around on upgrade?
Laurel: This should be fine on upgrade as (I believe) the custom HTML section is stored in the database. It’s not part of the themes where it would more likely be susceptible to breakage.
Having said that, I’ve not upgraded since so can’t be completely certain.
At Bath we’ve had the GA code in our custom HTML for a few years and never had to re-enter it after any of our many upgrades
Phil: Excellent. I suspected as much. It worked fine when we moved from 2.10.2 to 3.0.1
Any issues with security using this technique ?
This is the standard Google Analytics footer code. It’s as secure as all the other websites that use it.
Only use this if Google Analytics is a package you’re happy with.
Trackbacks
6 pings so far.