Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow admin users to customise the piwik.js code served by Piwik #6372

Closed
mattab opened this issue Oct 2, 2014 · 5 comments
Closed

Allow admin users to customise the piwik.js code served by Piwik #6372

mattab opened this issue Oct 2, 2014 · 5 comments
Assignees
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Oct 2, 2014

The goal of this issue is to let Piwik Super Users configure a custom JavaScript snippet of code that would automatically be appended to the/piwik.js tracking code served by the Piwik tracking server(s).

Proposed solution

  • 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 Heatmap plugin for Piwik + Click + Scroll maps #6371 could require CustomPiwikJs plugin and then insert custom JS tracker to store mouse positions and build heatmaps

Notes

  • 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!

@mattab mattab added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Critical Indicates the severity of an issue is very critical and the issue has a very high priority. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Oct 2, 2014
@mattab mattab added this to the Piwik 2.8.0 milestone Oct 2, 2014
@mattab mattab added the Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. label Oct 7, 2014
@mnapoli mnapoli self-assigned this Oct 13, 2014
@mnapoli
Copy link
Contributor

mnapoli commented Oct 13, 2014

When to update the file:

  • On update in the admin panel
  • Daily
  • Piwik update event
  • Plugin enable/disable event

Warning in the readme for load-balanced setups.

@mnapoli
Copy link
Contributor

mnapoli commented Oct 14, 2014

See #6440

@mattab
Copy link
Member Author

mattab commented Oct 14, 2014

The plugin is already available on the Marketplace! http://plugins.piwik.org/CustomTrackerJs

@mattab mattab removed the Critical Indicates the severity of an issue is very critical and the issue has a very high priority. label Oct 14, 2014
@mattab
Copy link
Member Author

mattab commented Oct 17, 2014

Well done @mnapoli

@mattab mattab closed this as completed Oct 17, 2014
@mattab
Copy link
Member Author

mattab commented Oct 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants