diff --git a/js/track.js b/js/track.js index 0b35beb..ccd9f14 100644 --- a/js/track.js +++ b/js/track.js @@ -49,7 +49,7 @@ var _paq = _paq || []; _paq.push(['setCustomVariable', '1', 'App', app, 'page']); } - if (OC && OC.currentUser) { + if (OC && OC.currentUser && options.trackUser) { // set user id _paq.push(['setUserId', OC.currentUser]); } diff --git a/lib/Controller/JavaScriptController.php b/lib/Controller/JavaScriptController.php index eeeab9c..bc15c76 100644 --- a/lib/Controller/JavaScriptController.php +++ b/lib/Controller/JavaScriptController.php @@ -40,6 +40,7 @@ public function tracking() 'url' => $this->config->getAppValue('url'), 'siteId' => $this->config->getAppValue('siteId'), 'trackDir' => $this->config->getBooleanAppValue('trackDir'), + 'trackUser' => $this->config->getBooleanAppValue('trackUser'), ]; $script = "var cloudPiwikOptions = '".json_encode($options)."';"; diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index b3474d2..bbfe123 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -37,7 +37,7 @@ public function index() public function update($key) { - if (!in_array($key, ['url', 'siteId', 'trackDir'])) { + if (!in_array($key, ['url', 'siteId', 'trackDir', 'trackUser'])) { return [ 'result' => 'error', 'message' => 'Tried to update not allowed param.', diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index dcb5a6e..2478445 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -30,6 +30,7 @@ public function getForm() 'url' => $this->config->getAppValue('piwik', 'url'), 'siteId' => $this->config->getAppValue('piwik', 'siteId'), 'trackDir' => $this->config->getAppValue('piwik', 'trackDir'), + 'trackUser' => $this->config->getAppValue('piwik', 'trackUser'), ]; return new TemplateResponse('piwik', 'settings/admin', $parameters); diff --git a/templates/settings/admin.php b/templates/settings/admin.php index 6984027..ed4ec9e 100644 --- a/templates/settings/admin.php +++ b/templates/settings/admin.php @@ -20,7 +20,13 @@