Hi,
I actually read the book of Piwik Web Analytics Essentials of Stephan A. Miller. I tried to create a new plugin following the steps in this book but it looks like that the methods had changed. This is the code :
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Piwik_AlexaWidget;
use Piwik\WidgetsList;
/**
*/
class Piwik_AlexaWidget extends \Piwik\Plugin
{
public function addWidgets()
{
//WidgetsList::add('The Category of the widget', 'Name of the widget', 'The widget's controller class name', 'The widget's controller function name');
WidgetsList::add('Example Widgets','Alexa Traffic Stats','Piwik_AlexaWidget', 'alexa');
}
}
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Piwik_AlexaWidget;
use Piwik\View;
/**
* A controller let's you for example create a page that can be added to a menu. For more information read our guide
* http://developer.piwik.org/guides/mvc-in-piwik or have a look at the our API references for controller and view:
* http://developer.piwik.org/api-reference/Piwik/Plugin/Controller and
* http://developer.piwik.org/api-reference/Piwik/View
*/
class Controller extends \Piwik\Plugin\Controller
{
public function alexa()
{
echo '<img src="http://traffic.alexa.com/graph?u=www.stephanmiller.com&c=1&w=400&h=220&y=r&r=3m&b=e6f3fc" />';
}
}
I activated the plugin and I checked the Example Widgets but nothing appears.
Thank you