Confluence with Google Analytics shows way to many users?

Timothy Harris June 28, 2015

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

0 votes
David Simpson v4.0
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2015

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/

 

Timothy Harris June 29, 2015

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 :-)

David Simpson v4.0
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2015

See the update above.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events