Skip to main content

Drupal Integration

Privacy-first, cookieless analytics for Drupal 9, 10, and 11.

Requirements

  • Drupal 9.x, 10.x, or 11.x
  • PHP 8.0 or higher

Installation

Option 1: Manual Installation

  1. Download and extract the module
  2. Copy to modules/contrib/sealmetrics or modules/custom/sealmetrics
  3. Go to Extend (/admin/modules)
  4. Enable "SealMetrics Analytics"
  5. Configure at Configuration > System > SealMetrics Analytics

Option 2: Composer

composer require drupal/sealmetrics
drush en sealmetrics

Configuration

  1. Go to /admin/config/system/sealmetrics
  2. Enter your Account ID (from your SealMetrics dashboard)
  3. Configure tracking options:
SettingDescription
Account IDYour SealMetrics Account ID (required)
Skip admin pagesDon't track admin page views
Track form submissionsTrack contact forms, webforms
Track contact forms as leadsTrack as conversions instead of events
Track search queriesTrack site searches
Track 404 errorsTrack broken link visits

Tracked Events

Automatic Events

EventDescription
pageviewAll page views with content grouping
form_submitForm submissions (unless newsletter)
newsletter_signupNewsletter form submissions
leadContact forms (if configured as lead)
searchSite search queries
404_errorPage not found errors

Content Groups

The module automatically detects content types:

Content TypeGroup
Front pagehome
Article/Blogblog
Pagepage
Productproduct
Taxonomy termcategory
User pagesaccount
Searchsearch
404404

Custom content types use their machine name as the group.

Form Detection

The module intelligently distinguishes between:

Newsletter Forms

Tracked as newsletter_signup microconversion:

  • Form ID/class contains: newsletter, subscribe, mailchimp, etc.
  • Forms with only an email field

Contact Forms

Tracked as form_submit or lead conversion:

  • All other forms (contact, quote requests, etc.)

Webform Integration

Full support for the Webform module:

  • Standard form submissions
  • AJAX form submissions
  • Multi-step forms (tracked on final submission)

Custom Event Tracking

Track custom events in your theme or module:

// Wait for SealMetrics to load
(function() {
function track() {
if (typeof sealmetrics !== 'undefined') {
sealmetrics.micro('custom_event', {
property: 'value'
});
} else {
setTimeout(track, 100);
}
}
track();
})();

Conversions

Track conversions (purchases, leads, signups):

// Lead conversion
sealmetrics.conv('lead', 0, {
source: 'quote_form'
});

// Purchase (if using Commerce)
sealmetrics.conv('purchase', 99.99, {
currency: 'EUR'
});

Drupal Commerce Integration

For e-commerce tracking with Drupal Commerce, add this to your order complete template or hook:

// In hook_commerce_order_place() or similar
function mymodule_track_purchase($order) {
$total = $order->getTotalPrice()->getNumber();
$currency = $order->getTotalPrice()->getCurrencyCode();

// Add inline script
$script = "
if (typeof sealmetrics !== 'undefined') {
sealmetrics.conv('purchase', {$total}, {
currency: '{$currency}'
});
}
";
// Attach to page via #attached
}

Privacy

  • No cookies used
  • No personal data collected
  • No order IDs or user IDs stored
  • GDPR compliant by design
  • No consent banner required