Returning JSON/JSONP from tracker

Is there a way to return JSON data / execute custom JS on the client website based on the request data? For example displaying popups/customer messages to client’s visitors based on url/cart, or triggering custom api calls on client’s platform?

In v2.16 I was doing it by hooking into actions with a plugin that would return JSON data and “hacking” the piwik.js to parse/run it, but recently updated to 3.0.2 and was wondering if there is a cleaner way of acomplishing this.

Yes, plugins can hook into the tracker piwik.js and add any custom code there. Please create an issue on: Issues · piwik/piwik · GitHub as I’m not too sure we have documented this properly yet

Thanks. Issue created at Document adding Custom JS to tracker via tracker.js / tracker.min.js · Issue #11572 · piwik/piwik · GitHub