diff --git a/Controller.php b/Controller.php index 25d4576..400e90b 100644 --- a/Controller.php +++ b/Controller.php @@ -43,6 +43,7 @@ class Controller extends \Piwik\Plugin\Controller "foregroundColor" => Common::getRequestVar('foregroundColor', "f00", 'string'), "lightColor" => Common::getRequestVar('lightColor', "222", 'string'), ]; + $historicValue = Common::getRequestVar('historicValue', 0, 'int'); try { if (!in_array($mode, $this->modes)) { $modestring = implode(", ", $this->modes); @@ -67,7 +68,7 @@ class Controller extends \Piwik\Plugin\Controller $cache->save($cacheKey, $visitData, 60); } $text = $visitData[$mode]; - $text = (int)$text; + $text = (int)$text + $historicValue; $errorMessage = false; } catch (\Exception $e) { $text = "Error"; diff --git a/README.md b/README.md index 501e851..f32ef3d 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ This plugin allows you to add an image showing the total amount of visits per `i ### Optional parameters: - `&mode=` one of `["nb_visits", "nb_actions", "nb_visits_converted", "bounce_count", "sum_visit_length", "max_actions", "bounce_rate", "nb_actions_per_visit", "avg_time_on_site"]` (responses from the `VisitsSummary.get` API) -- `backgroundColor`: A hex color without the `#` (e.g. `f00` or `fe1234`) -- `foregroundColor` -- `lightColor` +- `&backgroundColor=`: A hex color without the `#` (e.g. `f00` or `fe1234`) +- `&foregroundColor=` +- `&lightColor=` +- `&historicValue=`: A number that is added to the value from Matomo before being displayed. Useful if you want to add data from a counter before starting to use Matomo. diff --git a/plugin.json b/plugin.json index 9017a6c..f67627e 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "ClassicCounter", "description": "Embed a view counter in the style of classic CGI scripts into your website", - "version": "0.3.0", + "version": "0.3.1", "theme": false, "require": { "matomo": ">=4.0.0-b1,<5.0.0-b1"