Google Analytics Counter
Lightweight page view counter drawing on data collected by Google Analytics. Putting hardly any load on your Drupal installation. Working even on heavily cached websites. Highly customizable.
Features
- No burden on your server; the heavy work is done by Google Analytics
- Provides a block
- Provides an input filter for current or any other page, and also one counter for the whole website
- Works for any Drupal path (nodes, views, user profiles, ...)
- Can extrapolate page view count for cached values
- Can provide dynamic updates of the count even on cached pages
- Themeable (id="google-analytics-counter")
- Has a debug mode for experimentation
- A number of workarounds related to the rather arcane current Google Analytics API request quotas (though there is reasonable hope that Google will increase it sooner rather than later); on the settings page (/admin/settings/google_analytics_counter) you can set any fresh data retrieval period, enable showing extrapolated counts while working with cached values, set the period of concurrency (on very busy sites), choose a period of AJAX refresh (or disable it), etc.
- Optionally saves the values in Drupal's core's own table (node_counter), allowing you to show, sort and filter page access counts for all your nodes using Views
- ...
Depends on
- Google Analytics Reports [As of 6.x-2.x Google Analytics Counter (GAC) stopped relying on the discontinued Google Analytics API (http://drupal.org/project/google_analytics_api) and started to use the successor API bundled with Google Analytics Reports (http://drupal.org/project/google_analytics_reports).]
Installation
- Download Google Analytics Counter and Google Analytics Reports, then enable Google Analytics Counter and Google Analytics API (and modules it depends on - OAuth and for D6 also Autoload) at /admin/build/modules/list (not necessary to enable modules Google Analytics Reports and Chart!)
- Allow access to the Google Analytics account used on your website at /admin/settings/google-analytics-reports
- Set access permissions for Google Analytics Counter at /admin/user/permissions#module-google_analytics_counter
- Go to /admin/settings/filters/list and allow the Google Analytics Counter filter for the input type you will be using
- You can configure this module at /admin/settings/google_analytics_counter (but defaults will work fine for a start)
- Either enable block Google Analytics Counter, or place [
gac] in any page or custom block. If you need to show page views counter for a page other than the current one, use [gac|path/without/wrapping/slashes] (e.g. [gac|node/1]) - To show all page views of a website, use the following special tag: [
gac|all] - To use the counts in Views, enable the feature in settings at /admin/settings/google_analytics_counter (it is off by default), enable Drupal core module 'Statistics' (you can safely disable both the access log and content views counting at /admin/reports/settings) and set its permissions the way you wish at /admin/user/permissions#module-statistics, and in your Views (of nodes!), show/sort/filter by variable 'Node statistics: Total views'
- If you wish to load the counter using PHP, e.g. if you are integrating it in your template, use the output of function
google_analytics_counter_display($path = ''). Again, to show counter for the actual page, useecho google_analytics_counter_display(), for some other page use e.g.echo google_analytics_counter_display('node/145'), and to show the total countecho google_analytics_counter_display('all').
Roadmap
- A good idea, anybody?
For a demonstration and more information about this module, see vacilando.net/gac.
All comments and patches providing or leading to improvements are welcome in the issue queue.
This module is developed by Vacilando. Any and all donations are welcome here. The maintainer may be contacted for paid customizations of any Vacilando module, development of new modules, or urgent troubleshooting / patch reviewing.
| Wednesday 22. September 2010, Brussel, Belgium | ||
Demo
This page has 3034 page views ([gac])
Brilliant Gallery module page has 128034 page views ([gac|bg|debugoff])
The whole website has 690921 page views ([gac|all])
...




