PHPackages                             axllent/silverstripe-analytics-js - 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. axllent/silverstripe-analytics-js

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

axllent/silverstripe-analytics-js
=================================

Google Universal Analytics tracking code for Silverstripe

5.0.0(9mo ago)1721.4k5MITPHP

Since Jan 20Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/axllent/silverstripe-analytics-js)[ Packagist](https://packagist.org/packages/axllent/silverstripe-analytics-js)[ Docs](https://github.com/axllent/silverstripe-analytics-js)[ RSS](/packages/axllent-silverstripe-analytics-js/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

Google Universal Analytics for Silverstripe
===========================================

[](#google-universal-analytics-for-silverstripe)

### **Please note** that the functionality provided by this module is now fairly redundant since the release of Google Analytics 4 (GA4), and is no longer in active development.

[](#please-note-that-the-functionality-provided-by-this-module-is-now-fairly-redundant-since-the-release-of-google-analytics-4-ga4-and-is-no-longer-in-active-development)

If you're looking for an alternative then take a look at [springtimesoft/silverstripe-tracking-scripts](https://github.com/springtimesoft/silverstripe-tracking-scripts).

An extension to add Google **Universal Analytics** `gtag()` tracking code (not to be confused with Google Tag Manager) to your Silverstripe templates.

It automatically includes optional unobtrusive **event tracking** for all outbound links &amp; "asset downloads", as well as event tracking for 404 and error pages, email &amp; telephone links.

Features
--------

[](#features)

- Google Universal Analytics (gtag.js) code injected automatically into `` of page to prevent JavaScript conflicts due to loading order (if you are using custom `gtag()` functions in your other code.
- Automatic `pageview` tracking for all configured accounts, including tracking of 404 &amp; 500 page errors (tracked as "Page Not Found" / "Page Error" events).
- Unobtrusive outbound, download, email &amp; tel: link tracking - monitors all page clicks, rather than on page load (ie: works with links including those generated by Ajax etc on the page after page load).
- Uses Google Analytics `hitCallback` for tracking for outgoing links to register before load (ie: when no link `target` is set) to ensure tracker is successfully run before redirection.
- Tracking codes are automatically changed to `G-XXXXXXXX-[1-9]` if `SS_ENVIRONMENT_TYPE` is **not** live, or if page URL matches ?flush= to prevent bad data capture.

### Event tracking

[](#event-tracking)

Additional event tracking is automatically enabled by default for:

- File downloads (all non-image files in the assets folder) are tracked as "**Downloads**".
- Outgoing links are tracked as "**Outgoing Links**".
- Email (`mailto:`) links are tracked as "**Email Links**".
- Phone (`tel:`) links are tracked as "**Phone Links**".

Event category names (eg: "Outgoing Links", "Downloads" etc) can be configured in your yaml config.

**Note:** Event tracking only works with regular (left-or-middle) mouse button clicks (including combinations with Ctrl/Shift/Meta keys). Tracking is bypassed if the user right-clicks on a link and selects an action from the context menu (open in new tab, save as etc...). Unfortunately there is no way around this without disabling the content menu entirely.

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

[](#requirements)

- Silverstripe ^6

For Silverstripe 4 &amp; 5, please refer to the [Silverstripe5 branch](https://github.com/axllent/silverstripe-analytics-js/tree/silverstripe5).

For the deprecated `analytics.js` tracking method for Silverstripe 4, please refer to the [analytics.js branch](https://github.com/axllent/silverstripe-analytics-js/tree/3-analyticsjs).

For Silverstripe 3, please refer to the [Silverstripe3 branch](https://github.com/axllent/silverstripe-analytics-js/tree/silverstripe3).

Installation via Composer
-------------------------

[](#installation-via-composer)

You can install it via composer with

```
composer require axllent/silverstripe-analytics-js

```

Basic usage
-----------

[](#basic-usage)

Once installed the extension is automatically loaded if you provide at least one tracking account in your config yaml file (eg) `app/_config/analytics.yml`

```
Axllent\AnalyticsJS\AnalyticsJS:
  tracker:
    - ['config', 'G-XXXXXXXX']
```

The syntax is very similar to the official documentation, so things like secondary trackers or other configurations can be easily added.

```
Axllent\AnalyticsJS\AnalyticsJS:
  tracker:
    - ['config', 'G-XXXXXXXX']          # default account [required]
    - ['config', 'G-XXXXXXXX-1']          # add secondary tracker
    - ['set', 'forceSSL', true]           # force tracking to use SSL
    - ['require', 'ecommerce', 'ecommerce.js']  # load ecommerce extension
  track_links: false                      # disable external link & asset tracking
  ignore_link_class:  "notrack"           # if "track_links", then ignore external links with the "notrack" class
  compress_js: false                      # do not compress inline JavaScript
  primary_gtag_id: "G-XXXXXXXX"         # set the default tracking id to be used when loading gtag (defaults to the first tracker)
```

Please refer to the [Configuration.md](docs/en/Configuration.md) for all configuration options.

To start live tracking, make sure your website is in `live` mode, or if running in `dev` or `staging` that you have the `track_in_dev_mode: true` option.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance57

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 91.8% 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 ~208 days

Recently: every ~407 days

Total

18

Last Release

282d ago

Major Versions

2.0.0 → 3.0.02017-01-30

2.0.1 → 3.1.02017-02-16

2.0.2 → 3.1.62019-10-28

3.1.6 → 4.0.02020-11-03

4.0.4 → 5.0.02025-09-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1463435?v=4)[Ralph Slooten](/maintainers/axllent)[@axllent](https://github.com/axllent)

---

Top Contributors

[![axllent](https://avatars.githubusercontent.com/u/1463435?v=4)](https://github.com/axllent "axllent (90 commits)")[![UndefinedOffset](https://avatars.githubusercontent.com/u/1391558?v=4)](https://github.com/UndefinedOffset "UndefinedOffset (7 commits)")[![jflearn](https://avatars.githubusercontent.com/u/611385?v=4)](https://github.com/jflearn "jflearn (1 commits)")

---

Tags

google-analyticsgoogle-universal-analyticsgtagphpsilverstripeuniversal-analyticssilverstripetrackinganalyticsgoogleanalytics

### Embed Badge

![Health badge](/badges/axllent-silverstripe-analytics-js/health.svg)

```
[![Health](https://phpackages.com/badges/axllent-silverstripe-analytics-js/health.svg)](https://phpackages.com/packages/axllent-silverstripe-analytics-js)
```

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)

PHPackages © 2026

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