Automatically triggered Plugin development

Am trying to develop a plugin that is triggered automatically when data comes into piwik (basically this plugin collects the visitor info and exports to another application) , some of the possible methods are

  1. Access the database and trigger the plugin whenever data enters the Database
  2. call my plugin via the javascript tracking code, this probably requires piwik source code change
  3. change the piwik code which in turn calls the plugin.

Is there a plugin in the marketplace which does this? We prefer not to change the piwik source code so using a plugin would be a better option.
If no, then please suggest me which method is more efficient and less time consuming. Also share the documentations apart from the ones in regarding piwik core and plugin development.