Can someone clarify what this is showing me?

The "anonymous/authenticated users" number on the right-hand-side of the admin bar obviously should track those types of users to the site, but, is there something else that affects those numbers?

For example, when I compare the numbers I see there with the numbers I see at the end of the day with Google analytics, something is off.

My site is new and does not have a whole lot of traffic, but as we speak, it is showing "158/1". I'm fairly certain I will not have 158 anonymous users all week according to Google analytics.

Why is that number so high?

Thank you.

CommentFileSizeAuthor
Screenshot_3.png6.91 KBpkcho
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deverman’s picture

I have our editorial team asking me about this it would be nice to have some documentation. We just went through a site upgrade and at the same time installed the admin menu v3 and now they think our stats don't match our omniture we need to verify if this is a problem with the new site upgrade or admin menu change?

sun’s picture

Status: Active » Fixed

admin_menu is using the same logic as Drupal core's "Who's online" block to track and calculate visitors. If there's a flaw in that calculation then Drupal core needs to be fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

boabjohn’s picture

Status: Closed (fixed) » Active

G'Day all,

Thanks for pointing out that the logic is shared/mirrrored (?) from drupal core. I'm not sure that actually gets to the point here though.... the question is: *what* is causing the high numbers?

I have a site that has consistently shown up to 1500 anonymous users even though the logs show no trace of this activity.

This site sits on a VPS and we've been watching very high CPU usage and memory spikes as well.

I've just now put the site into maintenance mode, and after 30 mins the anonymous users dropped from 1400 to 10. But *not zero*. And now I can see the number climbing back up to 14...while the site is offline.

So okay...is it reasonable to ask what's going on with these numbers?

Or at least which end of the Drupal beast to start looking for clues?

Thanks in advance...your wizadry is very much appreciated.

nicksanta’s picture

Status: Active » Fixed

Hi All,

I've had a look into this problem. Basically, the anonymous user count in Drupal core's "who's online" block counts how many sessions are stored in the database, minus the number of authenticated sessions.

If you haven't correctly configured PHP to periodically cleanup the active sessions, the table will continue to grow. I just cleaned one today with ~75,000 old anonymous sessions. This not only causes confusion in the who's online block, but also has a severe performance impact on your site if it's mildly busy.

This article shows you what you need to put in settings.php to ensure your anonymous sessions are being cleaned: https://techcommons.stanford.edu/topics/drupal/sessions-table-cleanup

boabjohn’s picture

Hey @nicksanta: what a nice holiday gift! Thanks for looking into this and for posting your findings. Very helpful.

Season's cheers!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.