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
15 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
Or even better, you can use Piwik, which is free alternative to Google Analytics.
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.
Hi!
I’d like to find a feature/plugin/extension to Confluence that lists the viewers users of a given page.
I’ve look at this page, but didn’t find any.
Do you how to deploy this into Confluence?
Thank you!
Mauricio: The terms of service for Google Analytics require that all traffic data collected is anonymous. For your purpose, Google Analytics is not a good fit.
You may be able to use another analytics package such as Piwik to collect the data for this purpose, but I don’t know how mature a product it is.
Could you tell me exactly which information is transferred from CONFLUENCE to GOOGLE ANALYTICS? Please tell me also if GOOGLE ANALYTICS can see insight the CONFLUENCE server (through remote access) or has write access to our CONFLUENCE server.
Thanks in advance.
Patricia: The Google Analytics (GA) Javascript only collects information such as visitor information, referring page, browser, screen resolution and so on i.e. the normal stuff that is shown in Google Analytics reports.
Google Analytics does not read the content of your Confluence wiki pages or have write access to your Confluence server. The Javascript is executed client-side. So when Confluence is hosted behind a firewall, the client browser has access to the internet (and thus the hosted GA code) and also the Confluence server. But GA and Confluence do not need to have “line of sight” for the tracking Javascript to work.
Do you need the plugin? Can’t you just put the js code in the footer?
Kenn: There’s no need to install the plugin if you don’t want to use it. Just drop the GA javascript in the footer. Job done.
It allows you to show others a subset of Google Analytics reports without giving them access to your GA account. Only use it if you have that requirement.
Trackbacks
6 pings so far.