1
0
Fork 0
mirror of https://github.com/Findus23/plugin-ClassicCounter.git synced 2024-09-18 14:13:45 +02:00

allow adding historic value to counter

fixes #3
This commit is contained in:
Lukas Winkler 2021-02-18 11:39:13 +01:00
parent b45ec27726
commit 196377a85a
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 7 additions and 5 deletions

View file

@ -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";

View file

@ -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.
<img src="https://github.com/Findus23/plugin-ClassicCounter/blob/4.x-dev/screenshots/4909.png?raw=true" height="80">

View file

@ -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"