PHPackages                             promatur/sc-analytics - 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. promatur/sc-analytics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

promatur/sc-analytics
=====================

A combination of clientside and serverside analytics for PHP-based websites.

v1.1.5(2y ago)2665LGPL-3.0-or-laterPHPPHP ^7.3|^8.0CI failing

Since Mar 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Promatur/sc-analytics)[ Packagist](https://packagist.org/packages/promatur/sc-analytics)[ Docs](https://promatur.com/)[ Fund](https://paypal.me/adlerjan)[ RSS](/packages/promatur-sc-analytics/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (8)Dependencies (6)Versions (9)Used By (0)

Server-Client-Analytics
=======================

[](#server-client-analytics)

[![Latest Stable Version](https://camo.githubusercontent.com/580424b994505e0e14af40c72c34104c78c2d7fa4a38873a19a387f22fbf559c/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d617475722f73632d616e616c79746963732f762f737461626c65)](https://github.com/Promatur/sc-analytics/releases/latest)[![Latest Unstable Version](https://camo.githubusercontent.com/67d9509f0f6337d9829bbab065e07b1f7c184d673aa90a0bcd1f065c2428287e/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d617475722f73632d616e616c79746963732f762f756e737461626c65)](https://packagist.org/packages/promatur/sc-analytics)[![Total Downloads](https://camo.githubusercontent.com/aebf49de10528454a53181cf3d475af9d2ecb084be6ae249cc940b8e386529e6/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d617475722f73632d616e616c79746963732f646f776e6c6f616473)](https://packagist.org/packages/promatur/sc-analytics)[![License](https://camo.githubusercontent.com/499254b1dcfdcc8f14e6632d54372180ce75b2528d70f67fc60334fed525644b/68747470733a2f2f706f7365722e707567782e6f72672f70726f6d617475722f73632d616e616c79746963732f6c6963656e7365)](https://packagist.org/packages/promatur/sc-analytics)

Code Status
-----------

[](#code-status)

[![PHPUnit](https://github.com/promatur/sc-analytics/workflows/PHPUnit/badge.svg?branch=main)](https://github.com/promatur/sc-analytics/workflows/PHPUnit/badge.svg?branch=main)[![PHPStan](https://github.com/promatur/sc-analytics/workflows/PHPStan%20check/badge.svg?branch=main)](https://github.com/promatur/sc-analytics/workflows/PHPStan%20check/badge.svg?branch=main)[![Average time to resolve an issue](https://camo.githubusercontent.com/efdb9bf8c995bf8c8ec5f0fa795b582f3f20fec926f9406b5e6629f772964c0f/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f70726f6d617475722f73632d616e616c79746963732e737667)](http://isitmaintained.com/project/promatur/sc-analytics "Average time to resolve an issue")[![Percentage of issues still open](https://camo.githubusercontent.com/db29fce8450be3c40ae5bc3e918da3cf9bccc75197fcd4099881ea2abbe493b6/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f70726f6d617475722f73632d616e616c79746963732e737667)](http://isitmaintained.com/project/promatur/sc-analytics "Percentage of issues still open")

Description
-----------

[](#description)

[![SC-Analytics Logo](https://user-images.githubusercontent.com/56178675/167543506-ba3b3f1e-789c-4d9e-81ab-4158233c2e05.png)](https://user-images.githubusercontent.com/56178675/167543506-ba3b3f1e-789c-4d9e-81ab-4158233c2e05.png)

A combination of clientside and serverside analytics for PHP-based websites. This repository builds upon existing analytics solutions and offers integrations for [Matomo](https://matomo.org)and [Google Analytics](https://analytics.google.com). Tested using PHP `7.3`, `7.4` and `8.1`.

⠀

⠀

⠀

Usage
-----

[](#usage)

It is recommended to use SC-Analytics with composer, which is the easiest way to use it. Just add `promatur/sc-analytics`to your projects requirements.

```
composer require promatur/sc-analytics
```

Use some code like this one:

```
require_once 'vendor/autoload.php';

// - Configure your preferred analytics endpoint
\ScAnalytics\Core\AnalyticsConfig::$matomoID = "1";
\ScAnalytics\Core\AnalyticsConfig::$matomoEndpoint = "https://analytics.example.com/";

// - Initialize the analytics system
\ScAnalytics\Analytics::init();

// - Get your Analytics Handler
$analytics = Analytics::get();

// - Load the Client-Side JavaScript code and initialize the page view
$pageData = new \ScAnalytics\Core\PageData("Help Page", ["Support", "Help Page Overview"])
// Put this anywhere you want to load the JavaScript code
echo $analytics->loadJS($pageData);
```

Learn more in the [Wiki](https://github.com/Promatur/sc-analytics/wiki).

### Assets

[](#assets)

SC-Analytics also provides JavaScript assets. If you want the combination of server-side and client-side analytics, configure the location of the assets in your `composer.json`:

```
{
  "extra": {
    "assets-dir": "assets",
    "assets-strategy": "copy"
  }
}
```

If you want to use another folder for the assets, configure it in the config:

```
\ScAnalytics\Core\AnalyticsConfig::$assets = "my-directory";
```

Learn more about the [Composer Assets Plugin](https://github.com/frontpack/composer-assets-plugin).

### Error handling

[](#error-handling)

This package has an integration of [Sentry](https://github.com/getsentry/sentry-php), which is optional to use. Errors are automatically handled by Sentry and additional information is added.

Contributing
------------

[](#contributing)

### Using the library

[](#using-the-library)

This is a free/libre library under license LGPL v3 or later.

Your pull requests and/or feedback is very welcome!

### Contributors

[](#contributors)

Created by Jan-Nicklas Adler.

I am looking forward to your contributions and pull requests!

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~119 days

Recently: every ~138 days

Total

7

Last Release

855d ago

Major Versions

v0.1.0-alpha → v1.0.02022-03-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/56178675?v=4)[Jan](/maintainers/JE4GLE)[@JE4GLE](https://github.com/JE4GLE)

---

Top Contributors

[![JE4GLE](https://avatars.githubusercontent.com/u/56178675?v=4)](https://github.com/JE4GLE "JE4GLE (105 commits)")

---

Tags

analyticsgoogle-analyticsjavascriptmatomophpprivacywebweb-analyticsphpwebjavascriptmatomoanalyticsgoogle-analyticsprivacyweb-analytics

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/promatur-sc-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/promatur-sc-analytics/health.svg)](https://phpackages.com/packages/promatur-sc-analytics)
```

###  Alternatives

[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

211189.7k8](/packages/bezhansalleh-filament-google-analytics)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k70](/packages/verbb-formie)[fof/analytics

Tracks analytics using Google Analytics, Google Optimize/GTM and Matomo

3546.1k](/packages/fof-analytics)

PHPackages © 2026

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