Opened 6 years ago

Closed 13 months ago

#280 closed Task (worksforme)

Developer doc: build very simple example plugins

Reported by: matt Owned by: JulienM
Priority: major Milestone: Community and Marketing
Component: Documentation Keywords:
Cc: Sensitive: no

Description (last modified by matt)

It's hard to write a good developer documentation. Examples are easier to understand and to maintain. We will write a number of plugins, that each uses one feature of Piwik:

  • ExampleDBAccess
  • ExampleFeedburner
  • ExampleWidget
  • ExampleEditMenu
  • Other features to cover in example plugins: API, plotting data, recording new data in new db table, running tests, using a config file, using the "option" mechanism, etc.

Then we would:

  • build a wiki page listing all the Example plugins
  • print their quick description
  • link to their source code

Examples of other open source project plugin documentation

Ideas of simple useful plugins

  • "You have X websites and Y users registered in Piwik. You are using Piwik A.B version."
  • "Featured user" that randomly picks a use case from our use case base.
  • "Piwik has been downloaded N times."

Technical notes:

  • content loaded from piwik.org via highly cached proxy pages
  • if piwik.org is down, should not affect loading time of dashboard
  • have one widget for general purpose content (Piwik has been downloaded X times)

Change History (20)

comment:1 Changed 6 years ago by matt (mattab)

  • Summary changed from Developer documentation: build very simple example plugins to New documentation (developer): build very simple example plugins

comment:2 Changed 6 years ago by matt (mattab)

  • Description modified (diff)

comment:3 Changed 6 years ago by matt (mattab)

  • Description modified (diff)

comment:4 Changed 6 years ago by matt (mattab)

  • Component changed from Core to Documentation

comment:5 Changed 5 years ago by vipsoft (robocoder)

  • Milestone changed from DigitalVibes to Surviving The Wild

comment:6 Changed 5 years ago by matt (mattab)

  • Description modified (diff)

comment:7 Changed 5 years ago by matt (mattab)

  • Milestone changed from 3- Surviving The Wild to 2 - Piwik 0.8 - A Web Analytics platform
  • Sensitive unset

comment:8 Changed 4 years ago by matt (mattab)

  • Summary changed from New documentation (developer): build very simple example plugins to Developer doc: build very simple example plugins

comment:9 Changed 4 years ago by matt (mattab)

  • Milestone changed from 3 - Piwik 0.9 - Surviving The Wild to 4 - Piwik 1.0 - Stable release

comment:10 Changed 4 years ago by greg (gka)

I added two new widgets in changeset 2958

  • "You have X websites and Y users registered in Piwik. You are using Piwik A.B version."
  • "Piwik has been downloaded N times."

They demonstrate simple database queries and a remote API call to demo.piwik.org (via jquery ajax request). Both widgets use templates.

comment:11 Changed 4 years ago by halfdan

greg: You forgot to check in the en.php - both widgets appear but their translations are missing.

comment:12 Changed 3 years ago by matt (mattab)

We should also have the documentation point to ExampleUI plugin

comment:13 Changed 3 years ago by matt (mattab)

It would be nice to document how plugins can create new sections in the config file.

Something like this (but finding a way not to call the destruct would be better)

$config = Zend_Registry::get('config');
$config->MobileAnalytics = array("TeraWurflURL"=>"unconfigured");
$config->__destruct();
Piwik::createConfigObject();

I'm not sure why it wasn't working before, but this works great now.
Result:

[MobileAnalytics]
TeraWurflURL = "unconfigured"


comment:14 Changed 3 years ago by vipsoft (robocoder)

Agree. Planning a cleaner config writer should already be in #1713.

comment:15 Changed 3 years ago by matt (mattab)

Also, while writing dev doc, I recommend going through the config.ini.php settings to find out which ones could be of interest to the Piwik plugin developer (I'm thinking eg. disable_merged_assets, track_visits_inside_piwik_ui, always_archive_* etc.)

comment:16 Changed 3 years ago by matt (mattab)

  • Milestone changed from 1.1 - Piwik 1.1 to Community and Marketing

comment:17 Changed 3 years ago by JulienM (JulienMoumne)

The new general layout of the documentation is now in place (piwik.org/docs).

Plugin guides are part of the new organization but are yet to be written. The proposed list is :

Development Guides

Basic architecture
Adding a widget
Use Smarty templates
Accessing the database
Editing the menu
Using Piwik's API
Plotting Data
Recording new Data
Adding options in config.ini

comment:18 Changed 3 years ago by JulienM (JulienMoumne)

  • Owner set to JulienM

comment:19 Changed 3 years ago by JulienM (JulienMoumne)

  • Type changed from Bug to Task

Should include guide :

Internationalization and localization

See forum post

comment:20 Changed 13 months ago by matt (mattab)

  • Resolution set to worksforme
  • Status changed from new to closed

Mostly we have such simple plugins now. The docs are still missing but will be covered in separate plugin. For latest docs on plugin development see: http://new.piwik.org/docs/plugins/

Note: See TracTickets for help on using tickets.