[Solved] How To Count Views On Click Of A Button Or Web Page Is There Any Extension


I think , there is no need of any extension. Make a Ajax call on click button or image you are interested.

Improved:
I supposed you have Site as controller and index as action. then, please keep this code on views/site/index.php .

Yii::app()->clientScript->registerScript('logo_as_image_script', '$(document).ready(function() {
        $("#logo_as_image").click(function() {
            $.post("'.Yii::app()->createAbsoluteUrl('site/index').'",
                    {
                        clicked: "1"
                    },
            function(data, status) {
                alert("Data: " + data + "\nStatus: " + status);
            });
        });
    });');
Yii::app()->clientScript->registerCoreScript('jquery');
echo CHtml::image(Yii::app()->baseUrl . '/images/logo.png', 'Logo as Image', array('id' => 'logo_as_image'));

And, keep this code on SiteController.php .

public function actionIndex() 
{
    // keep record of data ; do more filtering ; other manupulation 
    if(isset($_POST['clicked'])){
        $nextCount = Yii::app()->user->getState('clickCount')+1; 
        Yii::app()->user->setState('clickCount',$nextCount );
        echo $nextCount;
        Yii::app()->end();
    }
    #other codes here. 
    $this->render('index');
}

3

solved How To Count Views On Click Of A Button Or Web Page Is There Any Extension