- we build a new plugin "CustomPiwikJs"
- this plugin would be open source and available in the Marketplace,
- Super User can enter a JS code snippet in the CustomPiwikJs plugin setting Textarea,
- the plugin defines a new console command that when executed will:
- generate a new piwik.js appending any custom script,
- if the generated piwik.js is different from the original /piwik.js
- then overwrite the /piwik.js file.
- appending JS script to piwik.js could be easily made available to
other plugins via a hook.
- This would lead to amazing potential for plugins to customise the tracking code served by Piwik to the websites and web apps!
- eg. plugin Heatmap #6371 could require CustomPiwikJs plugin and then insert custom JS tracker to store mouse positions and build heatmaps
- this logic would be executed as schedule task every 5 min or so if possible, and also once after each Piwik Upgrade.
- to make sure our sync task runs really every 5 min, we will need to setup a cron for user to execute this command every 5 minutes:
core:run-scheduled-tasks Will run all scheduled tasks due to run at this time.
- (if the last scheduled task ran more than N min ago, display a warning message notification that file may be out of sync)
feel free to post if you have any feedback!