Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

charlesportwoodii/yii2-analytics.js

Repository files navigation

Yii2 Analytics.js Integration

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

This extension provides Analytics.js integration for Yii Framework 2, and is the natural extension of 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.

Travis CI Packagist Version Downloads License Yii2


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

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. This extension directly passes the provider list and arguments to analytics.js.

Examples

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'
				]			
			]
		]
	]	
];

About

Segment.io's Analytics.js integration for Yii2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages