Skip to content

thiagotalma/yii2-hotjar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hotjar for Yii2

This extension provides easy way to add Hotjar tracking in your Yii2 application.

Based on https://github.com/cybercog/yii2-google-analytics

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require thiagotalma/yii2-hotjar "*

or add

"thiagotalma/yii2-hotjar": "*"

to the require section of your composer.json file.

Usage

In your /views/layouts/main.php add

use talma\hotjar\widgets\HotjarTracking;

Then before </head> add following code

<?= HotjarTracking::widget(
    [
        'trackingId' => 'XXXXXXXX'
    ]
) ?>

Advanced usage

If you need the output without script tag to combined with registerJs or registerJsFile as renderPartial to add dependency or positioning configuration, you can use omitScriptTag true to disable script tag, example:

<?= $this->registerJs(
    HotjarTracking::widget([
        'trackingId' => 'XXXXXXXX',
        'omitScriptTag' => true
    ]), \yii\web\View::POS_END
); ?>

About

Hotjar for Yii2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%