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

This widget could not be displayed.

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
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

487 views 6 6
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