Hotjar extension for the Yii2 framework

Installs: 6 943

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 8


v0.1 2016-05-30 15:07 UTC

This package is not auto-updated.

Last update: 2024-07-03 23:35:19 UTC


Hotjar for Yii2

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

Based on


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.


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(
        'trackingId' => 'XXXXXXXX',
        'omitScriptTag' => true
    ]), \yii\web\View::POS_END
); ?>