I want to modify piwik.js file from the script

Hello,
I want to write a plugin that modifies the main piwik.js file adding some new features into it. I read developer pages but couldnt find any api that would allow me doing some modifications into the piwik.js file, nor anything that would even allow me to merge several files into that one.

I’m not sure if i should use the event of javascript requesting - as its used on each request - i would like to add the changes once and then just use it.

Hi there,

To modify the Piwik.js script (append content to the file) you can use this plugin: http://plugins.piwik.org/CustomTrackerJs

It also adds a new event that lets other plugins extend the JS tracking code.

So this is exactly the same idea i wrote already. I was mostly asking if there is a better way of doing it (like already written api in the piwik itself). But thanks anyway^^