PHP code example of henhed / module-piwik

1. Go to this page and download the library: Download henhed/module-piwik library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

henhed / module-piwik example snippets


public function execute(\Magento\Framework\Event\Observer $observer)
{
    $tracker = $observer->getEvent()->getTracker();
    /** @var \Chessio\Matomo\Model\Tracker $tracker */
    $tracker->setDocumentTitle('My Custom Title');
}

public function __construct(\Chessio\Matomo\Model\Tracker $matomoTracker)
{
    $this->_matomoTracker = $matomoTracker;
}
sh
php bin/magento module:enable Chessio_Matomo --clear-static-content
js
var _paq = _paq || [];
_paq.push(['setDocumentTitle', 'My Custom Title']);