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.


 

Update:

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.

<script>
  // 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),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  
  AJS.toInit(function(){
    // 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');
    }
  });
 
</acript>

Don't mess with the Google Analytics base url. Keep to the root URL e.g. https://confluence.my.com/

 

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 https://myconfluence.my.com/dashboard.action? 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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

1,005 views 23 13
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