Confluence with Google Analytics shows way to many users?

I have set up google analytics on Confluence. Pasted the script at the end of head in custom html.

The instance only has about 160 users. It is showing 9000 plus users. This is first time I set up google analytics.

Has anyone else done this and would you have an idea as to why the user count is so wrong? 

1 answer

Hi Timothy

I'd recommend the approach described in this blogpost:
Tracking Atlassian Confluence usage with Google Analytics

How have you recorded 9000 users? Is it from within the Google Analytics interface?

Is the Confluence instance publicly available? If that's the case, you may be suffering from a problem with bots and spiders. This is easily fixed. Here's a good description of the problem and how to prevent it: Understanding Bot and Spider Filtering from Google Analytics.

If you need further help, get in touch wink

Best wishes, David.


Aside: The Google Analytics for Confluence add-on helps with the setup, displays analytics in context & also automatically removes traffic from bots & spiders.



If you only want to track logged in users, you can check to see if they are logged in using javascript and only then add the Google Analytics tracking code. e.g.

  // 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),
    // check for a logged in user
    if (AJS.params.remoteUser !== '') {
      ga('create', 'UA-XXXX-Y', 'auto'); // add your GA tracking code here
      // Add a page-level custom variable to record the space-key
      if (typeof AJS.params.spaceKey === 'string') {
        ga('set', 'dimension1', AJS.params.spaceKey); // Set a `spaceKey` dimension at page level
      ga('send', 'pageview');

Don't mess with the Google Analytics base url. Keep to the root URL e.g.


Yes the data is from the google analytic interface and it is also a public instance. I really only want to track data for logged in users. Whenever a user enters the base url in his browser he is redirected to a login page or a dashboard if he is already logged in. I only want to track from the dashboard. Can I just create a view with the dashboard as base url like Will this only track hits on this page or will it then track users as they browse to the other content on the confluence site? Pretty new to google analytics if you haven't guessed :-)

See the update above.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

983 views 2 13
Read article

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