PHPackages                             lerni/silverstripe-tracking - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lerni/silverstripe-tracking

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

lerni/silverstripe-tracking
===========================

Tracking Module for Silverstripe: Analytics, Tag Manager &amp; Clarity

6.x-dev(8mo ago)0398↓16.7%BSD-3-ClausePHP

Since Jul 2Pushed 8mo agoCompare

[ Source](https://github.com/lerni/silverstripe-tracking)[ Packagist](https://packagist.org/packages/lerni/silverstripe-tracking)[ Docs](https://github.com/lerni/silverstripe-tracking)[ RSS](/packages/lerni-silverstripe-tracking/feed)WikiDiscussions 5.x Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Silverstripe Analytics, Tag Manager, Clarity &amp; Bing Site-Verification Module
================================================================================

[](#silverstripe-analytics-tag-manager-clarity--bing-site-verification-module)

A Silverstripe module for Google Analytics, Google Tag Manager, Microsoft Clarity and Bing site verification. Features Consent Mode v2 support for privacy-compliant tracking, managed through Silverstripe's admin interface.

Requirements
------------

[](#requirements)

- silverstripe/cms ^5
- silverstripe/siteconfig ^5

Suggested
---------

[](#suggested)

- lerni/klaro-cookie-consent

Installation
------------

[](#installation)

[Composer](https://getcomposer.org/) is the recommended way to install Silverstripe modules.

```
composer require lerni/silverstripe-tracking
```

Run `dev/build`

This module allows XML files to be uploaded for Bing site verification.

Configuration
-------------

[](#configuration)

### Setup

[](#setup)

1. Go to **Settings &gt; Tracking** in the CMS admin
2. Add your tracking IDs:
    - **Google Tag Manager**: `GTM-XXXXXXX`
    - **Google Analytics v4**: `G-XXXXXXXXXX` (one per line for multiple properties)
    - **Microsoft Clarity**: Your Clarity project ID

### Consent Mode v2 Setup

[](#consent-mode-v2-setup)

1. **Enable Consent Mode**: Check "Enable Consent Mode v2" in Settings &gt; Tracking
2. **Cookie Consent Integration**: Install `lerni/klaro-cookie-consent` for consent management
3. **Setup callback events**: onAccept &amp; onDecline for each service as needed

### Additional Configuration

[](#additional-configuration)

```
Kraftausdruck\Extensions\PageTrackingExtension:
  # Include logged-in members in tracking (default: false)
  track_members: true
  # Enable preconnect links for improved performance (default: false)
  # Enabling preconnect may leak user IP addresses to Google/Microsoft even before consent is given, as DNS lookups and TCP connections are established early. Consider this when implementing strict privacy requirements.
  preconnect: true
```

How Consent Mode Works
----------------------

[](#how-consent-mode-works)

### Without Cookie Consent Manager

[](#without-cookie-consent-manager)

When no consent management is active, the module automatically sets conservative consent defaults:

```
gtag('consent', 'default', {
    'ad_storage': 'denied',
    'analytics_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied'
});
```

### With Klaro Cookie Consent

[](#with-klaro-cookie-consent)

When integrated with the Klaro module, consent is dynamically updated based on user choices:

```
// User accepts Analytics service
gtag('consent', 'update', {'analytics_storage': 'granted'});

// User accepts Advertising service
gtag('consent', 'update', {
    'ad_storage': 'granted',
    'ad_user_data': 'granted',
    'ad_personalization': 'granted'
});
```

### Multiple GA4 Properties

[](#multiple-ga4-properties)

Add multiple Google Analytics 4 properties (one per line):

```
G-XXXXXXXXXX
G-YYYYYYYYYY
G-ZZZZZZZZZZ

```

### Custom Configuration

[](#custom-configuration)

The module automatically includes enhanced security settings when Consent Mode is enabled:

```
gtag('config', 'GA_MEASUREMENT_ID', {
    'anonymize_ip': true,
    'cookie_flags': 'secure;samesite=lax'
});
```

Important Notes
---------------

[](#important-notes)

- **Live Mode Only**: Tracking codes are only shown in live mode (not in development)
- **Member Tracking**: By default, logged-in members are excluded from tracking.
- **Cookie Consent**: Use `lerni/klaro-cookie-consent` for GDPR-compliance

### Debug Mode

[](#debug-mode)

Enable debug mode to see consent state in browser console:

```
// In browser console
dataLayer.forEach(item => {
    if (item[0] === 'consent') console.log(item);
});
```

Resources
---------

[](#resources)

- [Google Consent Mode v2 Guide](https://developers.google.com/tag-platform/security/guides/consent)
- [Google Analytics 4 Documentation](https://developers.google.com/analytics/devguides/collection/ga4)
- [Microsoft Clarity Documentation](https://docs.microsoft.com/en-us/clarity/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance61

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Total

2

Last Release

245d ago

Major Versions

5.x-dev → 6.x-dev2025-09-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/e68b89567976eada21fddc5e776f4adcbe15ad846150cbcde6eb24bc185a8e5f?d=identicon)[lerni](/maintainers/lerni)

---

Top Contributors

[![lerni](https://avatars.githubusercontent.com/u/472115?v=4)](https://github.com/lerni "lerni (26 commits)")[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (6 commits)")

---

Tags

silverstripetrackingGoogle Tag Managergoogle-analyticsMicrosoft Clarity

### Embed Badge

![Health badge](/badges/lerni-silverstripe-tracking/health.svg)

```
[![Health](https://phpackages.com/badges/lerni-silverstripe-tracking/health.svg)](https://phpackages.com/packages/lerni-silverstripe-tracking)
```

###  Alternatives

[cyber-duck/silverstripe-google-tag-manager

Add Tag Manager data layer, events, and ecommerce support for SilverStripe

1528.0k](/packages/cyber-duck-silverstripe-google-tag-manager)[axllent/silverstripe-analytics-js

Google Universal Analytics tracking code for Silverstripe

1721.3k](/packages/axllent-silverstripe-analytics-js)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
