@loki495 opened this Issue on March 31st 2017

Is there a way for a plugin to add custom JS to tracker response and have the piwik.js parse/execute it?
https://forum.piwik.org/t/returning-json-jsonp-from-tracker/23657

@tsteur commented on April 1st 2017 Member

It is technically possible but as @mattab mentioned there are no docs which actually is missing because it is not really a public API and neither supported right now. Basically you can create a tracker.js file or tracker.min.js file in your plugin and it will be copied into the piwik.js

@mattab commented on June 21st 2017 Member

@tsteur maybe we could make this public API in Piwik 4? (moving tentatively)

@tsteur commented on June 22nd 2017 Member

could maybe make it but maybe lets see again when we get to it. Would require a bit more work and especially documentation. Not having a big opinion on it but would need to think more about it also for long term how this should work

@johsin18 commented on July 23rd 2018 Contributor

Let's document that this "API" exists, first of all. I used this interface also for my plugin for #11405 after trying hard with custom variables, setCustomTrackingParameter (not available for JS tracker) and so on... it was quite a pain.

@johsin18 commented on April 1st 2020 Contributor

What is also undocumented is that the plugin class needs to override the method isTrackerPlugin like so

public function isTrackerPlugin()                                                                      
{                                                                                                      
    // declare that this plugin's tracker(.min).js should be included in the JavaScript tracker code   
    return true;                                                                                       
}                                                                                                      

My plugin broke with Matomo 3.13 due to lacking this code, I had to make a bugfix release.
https://plugins.matomo.org/DevicePixelRatio/changelog

@tsteur commented on May 14th 2020 Member

@johsin18 fixed the isTrackerPlugin regression in https://github.com/matomo-org/matomo/pull/15954 and documented the tracker in https://github.com/matomo-org/developer-documentation/pull/345 which now only needs a review.

@tsteur commented on May 17th 2020 Member
This Issue was closed on May 17th 2020
Powered by GitHub Issue Mirror