Lightweight, scalable, no-nonsense, enable-and-forget page view counter drawing on data collected by Google Analytics. Hardly any load on your server, no impact on the user. Integration with Views for nodes. Highly customizable. Suitable even for large and high-traffic sites. And, since recently, completely independent from other modules.
Installing is a breeze -- authenticate to Google Analytics (see instructions below) and review the default settings (which should be fine in most cases). And make sure your cron is running. You can check the stats retrieval progress at /admin/config/system/google_analytics_counter/details!
This module provides total pageview counts for all website pages. It is similar to the core Statistics module counter, but it is much lighter and ultimately faster because it draws on data from Google Analytics. This also means that also cached pages are counted (which is not possible with the core Statistics module).
Since branch 7.x-3.x there is an option in the config page /admin/config/system/google_analytics_counter that allows you to use the module's table for storage. This means that the module is no longer depending on the core Statistics module. Further, with this option on you can also show, filter and sort by a new node property called "Pageview Total". Development of this branch has been partly sponsored by Australian Policy Online (APO) at Swinburne University of Technology.
- Virtually no burden on your server; the heavy work is done by Google Analytics
- Provides a block showing the page views for the current page
- 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, even admin pages ... anything not excluded from Google Analytics tracking).
- Themeable (class="google-analytics-counter")
- Google Analytics data retrieved during cron runs (user experience not impacted); cron periodicity and batch sizes can be set on the configuration page
- Using extremely little of the current Google Analytics API request quotas; on the configuration page you can set the quota and caching
- Can save the pageview values in an own table 'google_analytics_counter_storage' (such reuse of Drupal core Statistics module's table 'node_counter' works but it is not the preferred option any more)
- If using the module's storage table, the core Statistics module can be switched off. (If needed, however, you can have the Statistics module run alongside the GA Counter.)
- Views integration with any of the storage tables. If using the module's table, to add the counter values for nodes to your view you just need to add field "Pageview Total". Sorting and filtering by the counter values works as well. This for example allows you to show nodes sorted by their popularity!
- Each count per page includes count(s) of its alias(es), if any: e.g. if you your node/3 has path "projects" this module will provide the total of accesses to both variants
- Each count per page also includes count(s) of its redirect(s), if any: e.g. if a page alias is now "projects" but in the past it used to be "ideas" and even before it was "assignments", the module will detect that and the sum of counts will also include those old path versions (of course this requires the Redirect module)
- Provides a dashboard page with meta statistics relevant to the given Google Analytics profile and this module (totals, retrieval status, etc.)
- The most important configuration tasks you need to do show as alerts on the Status page
- Fully compatible with multilingual paths (i18n)
- Consistently performant even on very large sites and extremely scalable (e.g. on a site with 100,000,000 pages you can still provide a counter update for each of these pages once a day!)
- You will obviously need Google Analytics Counter. Download and enable just like any other Drupal module. There is no dependency.
- You will also need to have your site tracked by Google Analytics. You may use the Drupal module Google Analytics or other method.
- Authenticate a Google Analytics profile for your website (there will be a Status page warning until you do that) by navigating to
- You can configure this module at
Configuration -> System -> Google Analytics Counter(but defaults will work fine for a start)
- You can check the stats retrieval progress and other relevant information at
Configuration -> System -> Google Analytics Counter -> Dashboard
- Set access permissions for Google Analytics Counter at
Configuration -> System -> Google Analytics Counter -> Permissions
- Make sure your usual Drupal cron is functioning well (for testing, you can also run it manually directly from the provided Dashboard page)
- Set access permissions for Google Analytics Counter at
Configuration -> Google Analytics Counter -> Permissions
- Go to
Configuration -> Content authoring -> Text formatsand enable the Google Analytics Counter filter for the input type you will be using
- 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. [
- To show all page views of a website, use the following special tag: [
- To use the counts in Views we make use of the Drupal core module 'Statistics' (enabled as a dependency; its own counting at should of course be disabled and any old values will be overwritten) and set its permissions the way you wish at
People -> Permissions, and in your Views (of nodes!), show/sort/filter by variable 'Content/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, use
echo google_analytics_counter_display();, for some other page use e.g.
echo google_analytics_counter_display('node/145');, and to show the total count for the whole site use
- In [
gar] token or if calling the function
google_analytics_counter_get_sum_per_path()directly, you may specify a node in any way -- either by its node/nid path, or by its alias my/alias or even with its language prefix nl/node/nid or nl/my/alias. Even old aliases are counted in (requires the Redirect module)! All these are summed together when retrieving pageviews from Google Analytics (it's always the same node). However, this is not true about non-node paths -- counts for e.g. nl/custom/path and custom/path are always counted separately because they may be completely different pages (it would be rather difficult to tell).
- In case of troubles with the OAuth2 authentication it helps to reset its variables and try again. You can use a settings reset link at /admin/config/system/google_analytics_counter/dashboard.
- A good idea, anybody?
Detail installation and configuration instructions, demonstration and other information about this module are at vacilando.org/gac.
All comments and patches providing or leading to improvements are welcome in the issue queue. Accepting able co-maintainers with demonstrable vision for this module.
This module is developed and maintained by Tomáš Fülöpp / Vacilando. Any and all donations are welcome via GitTip. The maintainer is available for paid customizations of any Vacilando module, development of new modules, or urgent troubleshooting / patch reviewing.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Filters/Editors, Performance and Scalability, Statistics, Third-party Integration
- Reported installs: 1,418 sites currently report using this module. View usage statistics.
- Downloads: 23,230
- Automated tests: Enabled
- Last modified: April 25, 2016