Is there a way to display the Page view counter from the statistics module?

I have...
Statistics enabled - yes
Enable access log - yes
Count content views - yes

I have tried adding the Popular content block to various areas with no luck.

I have also created a custom view to see if the page views are being counted. I have added the field Content statistics: Total views, however, all content is showing zero (0). It appears that the page views are not being logged.

Comments

mpotter’s picture

Haven't looked at that specific block you mentioned, but in general I highly recommend *against* using the statistics module. This is a bad way to log "page views" because it requires hitting the database on every page view which will kill your site performance. The normal way statistics like this are gathered is by enabling the Google Analytics module (there is an oa_analytics apps you can enable for this). Then you can use a module such as ga_stats to pull down the analytics data and use it to create views of popular content, etc.

bherring’s picture

Thanks for the feedback.
Unfortunately our intranet is internal only and cannot be reached from a fully qualified domain name so we cant use Google Analytics.

I understand you have suggested not using it but I cant find any other option at the moment.

Interestingly I created a test content type not associated to any OG's and it worked...

bherring’s picture

Mike
Can you confirm if there is anything in OA preventing the shipped content types (Wiki, events, discussion, etc) from being counted as part of the core statistics module?

When we create custom content types the statistics work as expected.

Thanks
Brad

mpotter’s picture

We aren't doing anything to prevent this in Open Atrium that I can think of. Maybe it's the fact that we use Panelizer to display all the node pages. The concept of a "Page" in Drupal is pretty murky. With Panels you can put partial content in all sorts of blocks, views, etc. Or maybe it's an issue with Organic Groups. If you find the reason, let us know, but it's not something I can really help with since the Statistics module is not normally used or recommended for Atrium.

bherring’s picture

Thanks Mike. Looks like it is panelizer not triggering node view.

I am now using Radioactivity module.
Seems to work well and you can even choose not to write to the DB
http://www.wunderkraut.com/blog/radioactivity-2-basics/2011-12-05

Thanks again for your help

hefox’s picture

statistics counter is done during hook_exit, based on path https://api.drupal.org/api/drupal/modules%21statistics%21statistics.modu...

if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == NULL) {

So as long as viewing node/x, have the associated variables enabled (there's various settings), I don't see how panelizer would be preventing the stats from being enabled.

Actually, it looks like statistics has an option to use ajax to record the node count instead of during hook_exit. This is new in d7, didn't realize it'd been added. Was that the setting trying to use?