This module provides a new, pluggable analytics system for Drupal. It offers built-in JavaScript tracking with options to include or exclude specific pages, user roles, and users, and can integrate with external services like Google Analytics and Piwik.
Analytics gives your site one place to add and manage analytics and tag services, such as Google Tag Manager. Each service you add is listed on one page, where you can configure, reorder, enable or disable it. You can also keep users with a given permission from being tracked, and respect visitors' Do Not Track setting.
To submit bug reports and feature suggestions, or to track changes, use the issue queue.
Requirements
This module requires no modules outside of Drupal core. It requires Drupal 11.3 or later.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
- Give the roles that manage analytics the "Administer analytics" permission at Administration > People > Permissions. Users with it can add JavaScript to every page, so only give it to trusted roles.
- Go to Administration > Configuration > Web services > Analytics services (
/admin/config/services/analytics) and add a service. Pick its type, give it a name, and fill in its settings, such as the container or site ID. - Users with the "Bypass all analytics services" permission aren't tracked. Analytics also never runs on administration pages.
- On the Settings tab, choose whether to respect visitors' Do Not Track setting (on by default).
Included services
- Google Tag Manager: container ID, an optional data layer variable and JSON value, and the anti-flicker snippet for Google Optimize.
- Matomo (formerly Piwik): the URL of your Matomo installation and the site ID. For more Matomo features, such as user ID tracking, use the Matomo Analytics module instead.
Other modules can provide more services as #[AnalyticsService] plugins in src/Plugin/AnalyticsService, extending Drupal\analytics\Plugin\ServicePluginBase. To deprecate a plugin, set the attribute's deprecated property to a deprecation message: the plugin is no longer offered for new services, and services that use it are listed on the status report.
If a service's plugin no longer exists, for example because the module that provided it was uninstalled, the service outputs nothing and is listed on the status report, where it can be edited or deleted.
Maintainers
- Dave Reid - dave reid
Ask your assistant about Analytics
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.x-dev | Dev | 11 | Nov 21, 2026 | ||
| 2.0.0-beta1 | Pre-release | 11 | Nov 21, 2026 | ||
| 8.x-1.0-beta1 | Pre-release | 11 | Nov 21, 2026 | ||
| 8.x-1.0-alpha9 | Pre-release | 10–11 | Oct 7, 2025 |