How to extend Piwik.js to be able to call _paq.push('myPlugin::setConfig', 'key', 'value')

I want to create a new plugin that should retrieve the innerHTML from the analyzed website. To configure the specific css selectors I plan to provide a method like
_paq.push('myPlugin::setCssSelector', '.article-text h1')

In the developer documentation i did not find any guidance to do this. I may purchase a premium plugin liek “FormAnalytics” that surely extend piwik.js. But I’ll try to ask the community if someone can give me a hint to save this money.

PS: If I want to measure forms later, I’ll order a premium license. serious! :wink:

Thanks, Ricardo.

Hi there,

there’s not really an official API yet but you can see how it works here: piwik-plugin-DeviceFeatureWebGL/tracker.js at master · sgiehl/piwik-plugin-DeviceFeatureWebGL · GitHub

We haven’t made it a proper API yet and neither document it since we may change how this works in the future. You’d simply need to create that tracker.js and call the init method in the same way. Within the init method you can listen to various events such as Piwik.on('TrackerSetup', function (tracker) { tracker.setCssSelector = function (){...} }) and then you can call for example _paq.push(['setCssSelector', ...])

1 Like

Thanks Thomas for helping me!!! It works fine to set the selector. If you provide a better documentation for customizing the tracker js in the futute it would be great. I’ll observe the next releases for sure! :slight_smile: