From e169d99f7d6151b26c03ba0bf42a40b604f16e53 Mon Sep 17 00:00:00 2001 From: uf501ap Date: Wed, 20 Jun 2018 14:56:49 +0200 Subject: [PATCH] * Changed meta information * Changed wording from Piwik to Mamoto --- CHANGELOG.md | 20 +- README.md | 72 ++-- Reports/Base.php | 36 +- Reports/GetExposureResearchTools.php | 562 +++++++++++++-------------- plugin.json | 2 +- 5 files changed, 347 insertions(+), 345 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dc085..f32dfba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ -# Changelog - -* 0.1.0 Original release of the plugin (stable, 2016-07-04) -* 0.1.4 Added resources (stable, 2016-10-06) - * Resources (JavaScript example and SoSci Survey template) were added to integrate a selective exposure experiment into a survey - * A reference to the resources was added in the README, in the plugin description, and in the plugin itself -* 0.1.7 Compatibility with Piwik 3.x - * Changes report to appear in Piwik 3.x - * Shorten variable names for page times to comply with SPSS (max. 64 characters) \ No newline at end of file +# Changelog + +* 0.1.0 Original release of the plugin (stable, 2016-07-04) +* 0.1.4 Added resources (stable, 2016-10-06) + * Resources (JavaScript example and SoSci Survey template) were added to integrate a selective exposure experiment into a survey + * A reference to the resources was added in the README, in the plugin description, and in the plugin itself +* 0.1.7 Compatibility with Piwik 3.x + * Changes report to appear in Piwik 3.x + * Shorten variable names for page times to comply with SPSS (max. 64 characters) +* 0.1.8 Cleaning + * Removed two undefined variable issues that triggered error log entries \ No newline at end of file diff --git a/README.md b/README.md index 8d16d99..7ef2295 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,36 @@ -# ExposureResearchTools -Exposure Research Tools (Piwik Plugin) - -This plugin restructures data collected via Piwik to be used in Selective Exposure research. -It extracts an iditification variable from the first visit's GET request to allow merging survey data with observational data from Piwik. - -The tools adds a menu item "Research Tools" -> "Export Visits" to the Piwik menu. - -## Background details - -For a detailed discussion of the tool and its application in selective exposure research, please refer to our paper. - -Leiner, D. J., Scherr, S., & Bartsch, A. (2016). Using Open-Source Tools to Measure Online Selective Exposure in Naturalistic Settings. Communication Methods and Measures, 10(4), 199–216. [doi:10.1080/19312458.2016.1224825](http://doi.org/10.1080/19312458.2016.1224825) - -## Resources - -We have prepared a template for [SoSci Survey](http://www.soscisurvey.com). The template ... - -* opens a pop-up window with the stimulus (that should be monitored by Piwik to collect selective exposure data) -* stores the times when the pop-up was opened and closed (to compute the browsing time) -* closes the pop-up after a predefined time (optionally) -* supports pre and post surveys - -Using the template: - -* [Download the template](https://raw.githubusercontent.com/BurninLeo/ExposureResearchTools/master/resources/sosci.template.xml) -> Right-click + Save as -* Register an account on [SoSci Survey](http://www.soscisurvey.com) and create a new survey project -* Go to **Survey Project** -> **Project Settings** -> **Import Project or Questions** -* Select the XML file you just downloaded and import -* Go to **Compose Questionnaire** and try with the green play button - -Opening a pop-up in a different survey software: - -* There is a [JavaScript Example](https://github.com/BurninLeo/ExposureResearchTools/blob/master/resources/JavaScript%20Sample.txt) that could be used on other software that SoSci Survey. - -**Note:** To collect selective exposure data, yo need a Piwik installation and must edit the stimulus website to report to Piwik. Please read the instructions in the paper (Leiner et al., forthcoming) for details. +# ExposureResearchTools +Exposure Research Tools (Matomo Plugin) + +This plugin restructures data collected via Matomo (formerly known as Piwik) to be used in Selective Exposure research. +It extracts an iditification variable from the first visit's GET request to allow merging survey data with observational data from Matomo. + +The tools adds a menu item "Research Tools" -> "Export Visits" to the Matomo menu. + +## Background details + +For a detailed discussion of the tool and its application in selective exposure research, please refer to our paper. + +Leiner, D. J., Scherr, S., & Bartsch, A. (2016). Using Open-Source Tools to Measure Online Selective Exposure in Naturalistic Settings. Communication Methods and Measures, 10(4), 199–216. [doi:10.1080/19312458.2016.1224825](http://doi.org/10.1080/19312458.2016.1224825) + +## Resources + +We have prepared a template for [SoSci Survey](http://www.soscisurvey.com). The template ... + +* opens a pop-up window with the stimulus (that should be monitored by Matomo to collect selective exposure data) +* stores the times when the pop-up was opened and closed (to compute the browsing time) +* closes the pop-up after a predefined time (optionally) +* supports pre and post surveys + +Using the template: + +* [Download the template](https://raw.githubusercontent.com/BurninLeo/ExposureResearchTools/master/resources/sosci.template.xml) -> Right-click + Save as +* Register an account on [SoSci Survey](http://www.soscisurvey.com) and create a new survey project +* Go to **Survey Project** -> **Project Settings** -> **Import Project or Questions** +* Select the XML file you just downloaded and import +* Go to **Compose Questionnaire** and try with the green play button + +Opening a pop-up in a different survey software: + +* There is a [JavaScript Example](https://github.com/BurninLeo/ExposureResearchTools/blob/master/resources/JavaScript%20Sample.txt) that could be used on other software that SoSci Survey. + +**Note:** To collect selective exposure data, yo need a Matomo installation and must edit the stimulus website to report to Matomo. Please read the instructions in the paper (Leiner et al., forthcoming) for details. diff --git a/Reports/Base.php b/Reports/Base.php index 5cfd450..a483fd2 100755 --- a/Reports/Base.php +++ b/Reports/Base.php @@ -1,18 +1,18 @@ - + diff --git a/Reports/GetExposureResearchTools.php b/Reports/GetExposureResearchTools.php index d23fbfb..ba4b318 100755 --- a/Reports/GetExposureResearchTools.php +++ b/Reports/GetExposureResearchTools.php @@ -1,282 +1,282 @@ -category = 'Research Tools'; - $this->name = 'Export Visits'; // Piwik::translate('ExposureResearchToolsName'); - - // Piwik 3.x - $this->categoryId = 'Research Tools'; - $this->subcategoryId = 'Export Visits'; - - $this->dimension = new ExitPageUrl(); - $this->documentation = Piwik::translate('ExposureResearchToolsDocumentation'); - - // This defines in which order your report appears in the mobile app, in the menu and in the list of widgets - $this->order = 999; - - // By default standard metrics are defined but you can customize them by defining an array of metric names - // $this->metrics = array('nb_visits', 'nb_hits'); - - // Uncomment the next line if your report does not contain any processed metrics, otherwise default - // processed metrics will be assigned - // $this->processedMetrics = array(); - - // Uncomment the next line if your report defines goal metrics - // $this->hasGoalMetrics = true; - - // Uncomment the next line if your report should be able to load subtables. You can define any action here - // $this->actionToLoadSubTables = $this->action; - - // Uncomment the next line if your report always returns a constant count of rows, for instance always - // 24 rows for 1-24hours - // $this->constantRowsCount = true; - - // If a menu title is specified, the report will be displayed in the menu - $this->menuTitle = $this->name; - - // If a widget title is specified, the report will be displayed in the list of widgets and the report can be - // exported as a widget - // $this->widgetTitle = ''; - } - - /** - * Here you can configure how your report should be displayed. For instance whether your report supports a search - * etc. You can also change the default request config. For instance change how many rows are displayed by default. - * - * @param ViewDataTable $view - */ - public function configureView(ViewDataTable $view) - { - if (!empty($this->dimension)) { - $view->config->addTranslations(array('label' => $this->dimension->getName())); - } - - // $view->config->show_search = false; - // $view->requestConfig->filter_sort_column = 'nb_visits'; - // $view->requestConfig->filter_limit = 10'; - - $view->config->columns_to_display = array_merge(array('label'), $this->metrics); - } - - /** - * Here you can define related reports that will be shown below the reports. Just return an array of related - * report instances if there are any. - * - * @return \Piwik\Plugin\Report[] - */ - public function getRelatedReports() - { - return array(); // eg return array(new XyzReport()); - } - - /** - * A report is usually completely automatically rendered for you but you can render the report completely - * customized if you wish. Just overwrite the method and make sure to return a string containing the content of the - * report. Don't forget to create the defined twig template within the templates folder of your plugin in order to - * make it work. Usually you should NOT have to overwrite this render method. - * - * @return string - */ - public function render() - { - /* - $view = new View('@ExposureResearchTools/GetExposureResearchTools'); - $view->myData = array(); - return $view->render(); - */ - - $aLimit = (int)\Piwik\Common::getRequestVar('vlimit', 100, 'int'); - if ($aLimit === 0) { - $aLimit = 100; - } - $getVar = (string)\Piwik\Common::getRequestVar('casevar', 'num', 'string'); - - /* - if ($send === 'yes') { - $api = \Piwik\Plugins\ExposureResearchTools\API::getInstance(); - $data = $api->getExposureResearchTools( - \Piwik\Common::getRequestVar('idSite'), - \Piwik\Common::getRequestVar('date'), - \Piwik\Common::getRequestVar('period'), - \Piwik\Common::getRequestVar('segment') - ); - - var_dump($data); - - exit; - } else { - */ - - // Copy all parameters - /* - $params = ''; - foreach ($_REQUEST as $key => $value) { - if (in_array($key, array('vlimit', 'casevar', 'format'))) { - continue; - } - $monkey = "\r\n".''; - } - */ - - return - '
-
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Limit activities per visit:
Read subject ID from GET variable:
Data structure: - -
- - -
- - -
- - -
- - -
- - -
- - -
- Note: All available data will be exported, regardless of the period defined above. -
- -
- -
-
- -

File Structure

-

Depending on the file structure selected above, the variables in the result will be:

- -

Note: Piwik will not record the time spent on the most recent page (activity). This affects Tn, AT, AT_xyz, and time.

-

Note: If Excel won\'t open the file correctly (all data in one cell), download the CSV file to disk, - then start Excel and open via menu → file → open. OpenOffice Calc will cause less trouble.

- -

Additional Information

-

If you\'re interested in doing selective exposure research with this tool, the following may be helpful:

- '; - } - - /** - * By default your report is available to all users having at least view access. If you do not want this, you can - * limit the audience by overwriting this method. - * - * @return bool - public function isEnabled() - { - return Piwik::hasUserSuperUserAccess() - } - */ +category = 'Research Tools'; + $this->name = 'Export Visits'; // Piwik::translate('ExposureResearchToolsName'); + + // Piwik 3.x + $this->categoryId = 'Research Tools'; + $this->subcategoryId = 'Export Visits'; + + $this->dimension = new ExitPageUrl(); + $this->documentation = Piwik::translate('ExposureResearchToolsDocumentation'); + + // This defines in which order your report appears in the mobile app, in the menu and in the list of widgets + $this->order = 999; + + // By default standard metrics are defined but you can customize them by defining an array of metric names + // $this->metrics = array('nb_visits', 'nb_hits'); + + // Uncomment the next line if your report does not contain any processed metrics, otherwise default + // processed metrics will be assigned + // $this->processedMetrics = array(); + + // Uncomment the next line if your report defines goal metrics + // $this->hasGoalMetrics = true; + + // Uncomment the next line if your report should be able to load subtables. You can define any action here + // $this->actionToLoadSubTables = $this->action; + + // Uncomment the next line if your report always returns a constant count of rows, for instance always + // 24 rows for 1-24hours + // $this->constantRowsCount = true; + + // If a menu title is specified, the report will be displayed in the menu + $this->menuTitle = $this->name; + + // If a widget title is specified, the report will be displayed in the list of widgets and the report can be + // exported as a widget + // $this->widgetTitle = ''; + } + + /** + * Here you can configure how your report should be displayed. For instance whether your report supports a search + * etc. You can also change the default request config. For instance change how many rows are displayed by default. + * + * @param ViewDataTable $view + */ + public function configureView(ViewDataTable $view) + { + if (!empty($this->dimension)) { + $view->config->addTranslations(array('label' => $this->dimension->getName())); + } + + // $view->config->show_search = false; + // $view->requestConfig->filter_sort_column = 'nb_visits'; + // $view->requestConfig->filter_limit = 10'; + + $view->config->columns_to_display = array_merge(array('label'), $this->metrics); + } + + /** + * Here you can define related reports that will be shown below the reports. Just return an array of related + * report instances if there are any. + * + * @return \Piwik\Plugin\Report[] + */ + public function getRelatedReports() + { + return array(); // eg return array(new XyzReport()); + } + + /** + * A report is usually completely automatically rendered for you but you can render the report completely + * customized if you wish. Just overwrite the method and make sure to return a string containing the content of the + * report. Don't forget to create the defined twig template within the templates folder of your plugin in order to + * make it work. Usually you should NOT have to overwrite this render method. + * + * @return string + */ + public function render() + { + /* + $view = new View('@ExposureResearchTools/GetExposureResearchTools'); + $view->myData = array(); + return $view->render(); + */ + + $aLimit = (int)\Piwik\Common::getRequestVar('vlimit', 100, 'int'); + if ($aLimit === 0) { + $aLimit = 100; + } + $getVar = (string)\Piwik\Common::getRequestVar('casevar', 'num', 'string'); + + /* + if ($send === 'yes') { + $api = \Piwik\Plugins\ExposureResearchTools\API::getInstance(); + $data = $api->getExposureResearchTools( + \Piwik\Common::getRequestVar('idSite'), + \Piwik\Common::getRequestVar('date'), + \Piwik\Common::getRequestVar('period'), + \Piwik\Common::getRequestVar('segment') + ); + + var_dump($data); + + exit; + } else { + */ + + // Copy all parameters + /* + $params = ''; + foreach ($_REQUEST as $key => $value) { + if (in_array($key, array('vlimit', 'casevar', 'format'))) { + continue; + } + $monkey = "\r\n".''; + } + */ + + return + '
+
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Limit activities per visit:
Read subject ID from GET variable:
Data structure: + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ Note: All available data will be exported, regardless of the period defined above. +
+ +
+ +
+
+ +

File Structure

+

Depending on the file structure selected above, the variables in the result will be:

+ +

Note: Matomo will not record the time spent on the most recent page (activity). This affects Tn, AT, AT_xyz, and time.

+

Note: If Excel won\'t open the file correctly (all data in one cell), download the CSV file to disk, + then start Excel and open via menu → file → open. OpenOffice Calc will cause less trouble.

+ +

Additional Information

+

If you\'re interested in doing selective exposure research with this tool, the following may be helpful:

+ '; + } + + /** + * By default your report is available to all users having at least view access. If you do not want this, you can + * limit the audience by overwriting this method. + * + * @return bool + public function isEnabled() + { + return Piwik::hasUserSuperUserAccess() + } + */ } \ No newline at end of file diff --git a/plugin.json b/plugin.json index a878239..3a36cd8 100644 --- a/plugin.json +++ b/plugin.json @@ -18,7 +18,7 @@ "docs": "https://github.com/BurninLeo/ExposureResearchTools" }, "require": { - "piwik": ">=2.16.0", + "piwik": ">=2.16.0,<4.0.0-b1", "php": ">=5.3.0" } }