PHPackages                             charlesportwoodii/yii2-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. [API Development](/categories/api)
4. /
5. charlesportwoodii/yii2-analytics.js

AbandonedArchivedYii2-extension[API Development](/categories/api)

charlesportwoodii/yii2-analytics.js
===================================

Segment's Analytics.js library integration for Yii2

1.0.0(10y ago)1736MITPHP

Since Oct 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/charlesportwoodii/yii2-analytics.js)[ Packagist](https://packagist.org/packages/charlesportwoodii/yii2-analytics.js)[ RSS](/packages/charlesportwoodii-yii2-analyticsjs/feed)WikiDiscussions master Synced 1mo ago

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

Yii2 Analytics.js Integration
=============================

[](#yii2-analyticsjs-integration)

This package is unmaintained, and is archived for historical purposes.

This extension provides [Analytics.js](https://segment.com/docs/libraries/analytics.js/) integration for [Yii Framework 2](www.yiiframework.com), and is the natural extension of [EAnalytics](https://github.com/charlesportwoodii/EAnalytics) which performs the same task for Yii1. This extension enables you to control and manage your analytics providers from within your Yii2 configuration, or in more complex examples, from a dynamic configuration.

For licensing information see [LICENSE.md](LICENSE.md).

[![Travis CI](https://camo.githubusercontent.com/cb4365962f3ef7459b18326286849bec9661a40da89d8ef0f72ebe4c1044d1ed/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636861726c6573706f7274776f6f6469692f796969322d616e616c79746963732e6a732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/charlesportwoodii/yii2-analytics.js)[![Packagist Version](https://camo.githubusercontent.com/9df83184a5659ff269f580501b763dfc46349aabdaf26bdf1ce8a5df2c830528/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636861726c6573706f7274776f6f6469692f796969322d616e616c79746963732e6a732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/charlesportwoodii/yii2-analytics.js)[![Downloads](https://camo.githubusercontent.com/84ddc303acc2cfef778ab60ef3ae5647863a873323f3fdf5ad7b56d823536366/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636861726c6573706f7274776f6f6469692f796969322d616e616c79746963732e6a732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/charlesportwoodii/yii2-analytics.js)[![License](https://camo.githubusercontent.com/b37fbf1d9e70438f48ceb1f4a3f73d8f612d2aae4f84559738bdfa19f191edbf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6f72616e67652e7376673f7374796c653d666c61742d737175617265 "License")](LICENSE.md)[![Yii2](https://camo.githubusercontent.com/caa07fe5c2d65aec86e62e1957ad3df612d53c4f055c8209179f12407e806242/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c61742d737175617265)](http://www.yiiframework.com/)

---

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

[](#installation)

The preferred way to install this extension is through composer.

```
composer require --prefer-dist "charlesportwoodii/yii2-analytics.js"

```

or add the following to your `composer.json`'s `require-dev` section.

```
"charlesportwoodii/yii2-analytics.js": "~1.0.0"

```

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

[](#configuration)

To use this configuration, add the following to your `config/web.php` configuration file:

```
return [
	// [...],
	'components' => [
		'analyticsjs' => [
			'class' => 'charlesportwoodii\analytics\AnalyticsJs',
			'providers' => [

			]
		]
	]
];

```

A full list of providers and their arguments can be found on [the Analytics.js integrations page](https://segment.com/docs/integrations/). This extension directly passes the provider list and arguments to analytics.js.

### Examples

[](#examples)

#### Google Analytics

[](#google-analytics)

```
return [
	// [...],

	'components' => [
		// [...],

		'analyticsjs' => [
			'class' => 'charlesportwoodii\analytics\AnalyticsJs',
			'providers' => [
				// Google Analytics Provider
				'Google Analytics' => [
					'domain' 					=> 'https://www.example.com',
					'doubleClick' 				=> false,
					'enhancedLinkAttribution' 	=> false,
					'trackingId' 				=> 'UA-XXXXXXXX',
					'universalClient' 			=> 1
				],

				// Piwik provider
				'Piwik' => [
					'siteId' 					=> 5,
					'url'						=> 'https://piwik.example.com'
				]
			]
		]
	]
];

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3868d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/630969?v=4)[Charles R. Portwood II](/maintainers/charlesportwoodii)[@charlesportwoodii](https://github.com/charlesportwoodii)

---

Top Contributors

[![charlesportwoodii](https://avatars.githubusercontent.com/u/630969?v=4)](https://github.com/charlesportwoodii "charlesportwoodii (20 commits)")

---

Tags

yii2analyticsanalytics.jssegment

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/charlesportwoodii-yii2-analyticsjs/health.svg)

```
[![Health](https://phpackages.com/badges/charlesportwoodii-yii2-analyticsjs/health.svg)](https://phpackages.com/packages/charlesportwoodii-yii2-analyticsjs)
```

###  Alternatives

[baibaratsky/yii2-ga-measurement-protocol

Google Analytics Measurement Protocol for Yii2

13104.2k](/packages/baibaratsky-yii2-ga-measurement-protocol)[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[conquer/services

Yii2 soap wsdl web services

1632.5k](/packages/conquer-services)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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