The CustomTrackerJs
plugin lets the super users or other plugins add custom code to the Piwik Javascript Tracker.
Super users can set the Javascript code they want to add to the piwik.js
file in Settings > Plugin settings
.
Any code added in the Javascript code textbox will be appended to piwik.js
by a scheduled task. Be very careful
as to write valid Javascript code since invalid code can break the tracker.
Plugins can make use of the CustomTrackerJs.getTrackerJsAdditions
event to register Javascript code to add to
the tracker.
For example this will add a console.log("Hello world!");
line to the tracker:
class MyPlugin extends \Piwik\Plugin
{
public function getListHooksRegistered()
{
return array(
'CustomTrackerJs.getTrackerJsAdditions' => 'getTrackerJsAdditions',
);
}
public function getTrackerJsAdditions(&$code)
{
$code .= PHP_EOL . 'console.log("Hello world!");';
}
}
- 1.2.1
- Added possibility to run update command without database connection
- 1.2.0
- PPCDEV-4340 add possibility to add code at the top of the piwik.js
- 1.1.2
- Marketplace release
- 1.1.0
- PPCDEV-2609 Compatibility with Piwik 2.16.0
Please contact us at [email protected] in case you are facing a bug.
Plugin created and maintained by Piwik PRO.