lexeo/yii-yandex-metrika

此包最新版本(dev-master)没有可用的许可证信息。

简单的Yii小部件,用于在网页上添加YandexMetrika计数器/信息显示

dev-master 2014-10-13 06:59 UTC

This package is auto-updated.

Last update: 2024-09-25 06:28:44 UTC


README

简单的Yii小部件,用于在网页上添加YandexMetrika计数器/信息显示

##需求

与Yii 1.1.14开发和测试。应在所有1.1.x版本上工作。

##使用方法

###基本

[php]
/* @var $this CController */
$this->widget('ext.yii-yandex-metrika.EYandexMetrikaWidget', array(
   'id' => 123456789, // 
   'clickMap' => true,
   'trackLinks' => true,
   'accurateTrackBounce' => true,
));

[php]
/* config/main.php */
'components' => array(
    'widgetFactory' => array(
    	'widgets' => array(
            'EYandexMetrikaWidget' => array(
                // you can disable it while working on local machine
    	        'enabled' => true, 
    	        'id' => 123456789,
    	        'clickMap' => true,
    	        'trackLinks' => true,
    	        'accurateTrackBounce' => true,
    	        
                'informerOptions' => array(
                    'backgroundColor' => '#427a4b', // hex color code
                    'textColor' => 1, // 0|1
                    'arrowColor' => 0, // 0|1
                    'dataType' => 'visits', // visits|pageviews|uniques
                    'type' => 1, // 0|1
                ),
            ),
        ),
    ),
),

/* view|layout file */

$this->widget('ext.yii-yandex-metrika.EYandexMetrikaWidget');

###渲染信息显示

[php]
/* @var $this CController */
$this->widget('ext.yii-yandex-metrika.EYandexMetrikaWidget', array(
    'id' => 123456789,
   'informer' => true,
   'informerSize' => 1, // 1|2|3
   'informerDataType' => 'uniques',
    'informerArrowColor' => 1, // 0|1 
   // or
   'informerOptions' => array(
        'textColor' => 0,
        'backgroundColor' => '#b7b7b7',
        'size' => 2,
   ),
));

[php]
/* config/main.php */
'components' => array(
    'widgetFactory' => array(
    	'widgets' => array(
            'EYandexMetrikaWidget' => array(
    	        'id' => 123456789,
    	        // ...
                'informerOptions' => array(
                    'backgroundColor' => '#427a4b', // hex color code
                    'textColor' => 1, // 0|1
                    'arrowColor' => 0, // 0|1
                    'dataType' => 'pageviews',
                ),
            ),
        ),
    ),
),

/* view|layout file */

$this->widget('ext.yii-yandex-metrika.EYandexMetrikaWidget', array('informer' => true));