PHPackages                             xruff/googleanalytics - 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. xruff/googleanalytics

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

xruff/googleanalytics
=====================

Nette extension - Google Analytics code

v2.0.4(3y ago)0779BSD-3-ClausePHP

Since Apr 27Pushed 3y ago2 watchersCompare

[ Source](https://github.com/XRuff/GoogleAnalytics)[ Packagist](https://packagist.org/packages/xruff/googleanalytics)[ RSS](/packages/xruff-googleanalytics/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (5)Versions (11)Used By (0)

Google Analytics component for Nette Framework application
==========================================================

[](#google-analytics-component-for-nette-framework-application)

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

[](#requirements)

Package requires PHP 5.6 or higher

- [nette/security](https://github.com/nette/security)
- [nette/application](https://github.com/nette/application)

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

[](#installation)

The best way to install XRuff/GoogleAnalytics is using [Composer](http://getcomposer.org/):

```
$ composer require xruff/googleanalytics
```

Documentation
-------------

[](#documentation)

Configuration in config.neon. Both parameters are optional.

If parameter `code` is missing, GA code will not be rendered in template. If parameter `user` is missing, default settings will be used - value `on`. If paramter `user` is `on` and user is logged in, google analytics code will contain directive `ga('set', 'userId', {$user->id});`

```
extensions:
    googleAnalytics: XRuff\App\UI\Components\DI\GoogleAnalyticsExtension

googleAnalytics:
    code: UA-123456789-1
    user: on # on/off - display user ID if user is logged in
```

Base presenter:

```
use XRuff\App\UI\Components\IGoogleAnalyticsControlFactory;

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	/** @var IGoogleAnalyticsControlFactory $googleAnalyticsControlFactory @inject */
	public $googleAnalyticsControlFactory;

	protected function createComponentGoogleAnalytics()
	{
		return $this->googleAnalyticsControlFactory->create();
	}
}
```

@layout.latte:

```
    ...

    {control googleAnalytics}
    ...
```

You can invoke parameters into control in latte template. 1st parameter is GA code. 2nd parameter should be boolean and manage displaying GA directive for user's session - `ga('set', 'userId', {$user->id});`. Both parameters are optioanl.

```
    ...

    {control googleAnalytics 'UA-123456789-2', false}
    ...
```

---

Repository .

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~232 days

Recently: every ~250 days

Total

10

Last Release

1217d ago

Major Versions

0.0.1 → 1.0.02017-04-27

v1.1.0 → v2.0.02020-04-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/2eadb96b627cd99367bb565aa4c6058b276146ec587a6ea9f81b1ce1642dca3c?d=identicon)[xruff](/maintainers/xruff)

---

Top Contributors

[![pavellauko](https://avatars.githubusercontent.com/u/861888?v=4)](https://github.com/pavellauko "pavellauko (6 commits)")

---

Tags

google-analyticsnettenette-componentgooglenettecomponentanalyticsga

### Embed Badge

![Health badge](/badges/xruff-googleanalytics/health.svg)

```
[![Health](https://phpackages.com/badges/xruff-googleanalytics/health.svg)](https://phpackages.com/packages/xruff-googleanalytics)
```

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[contributte/menu-control

Menu control for Nette framework

29108.6k1](/packages/contributte-menu-control)[carrooi/nette-menu

Menu control for Nette framework

2950.0k1](/packages/carrooi-nette-menu)[setono/sylius-analytics-plugin

Google Analytics plugin for Sylius

23329.6k](/packages/setono-sylius-analytics-plugin)[lexik/data-layer-bundle

Manipulate the Google Tag Manager Data Layer from your Symfony application.

14114.2k](/packages/lexik-data-layer-bundle)[cybercog/yii2-google-analytics

Google Analytics Widget for the Yii2 framework

1677.1k2](/packages/cybercog-yii2-google-analytics)

PHPackages © 2026

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