diff --git a/.docker/.env b/.docker/.env
index c5e08fd23..da0d9b4d0 100644
--- a/.docker/.env
+++ b/.docker/.env
@@ -84,3 +84,10 @@ DOWNLOAD_SERVICE_PORT=6502
DOWNLOAD_SERVICE_DEST=http://fcrepo:8080/fcrepo/rest/files
UNPAYWALL_REQUEST_EMAIL=admin@oa-pass.org
UNPAYWALL_BASEURI=https://api.unpaywall.org/v2
+
+# mariadb
+MYSQL_DATABASE=matomo
+MYSQL_ROOT_PASSWORD=hello
+
+# matomo
+
diff --git a/.docker/config.ini.php b/.docker/config.ini.php
new file mode 100644
index 000000000..65db5340b
--- /dev/null
+++ b/.docker/config.ini.php
@@ -0,0 +1,82 @@
+; DO NOT REMOVE THIS LINE
+; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file.
+[database]
+host = "db"
+username = "root"
+password = "hello"
+dbname = "matomo"
+tables_prefix = "matomo_"
+charset = "utf8mb4"
+
+[General]
+salt = "acc08f58025c33e0780767b669f9d236"
+assume_secure_protocol = 1
+force_ssl = 1
+proxy_client_headers[] = HTTP_X_FORWARDED_FOR
+proxy_host_headers[] = HTTP_X_FORWARDED_HOST
+proxy_uri_header = 1
+
+[PluginsInstalled]
+PluginsInstalled[] = "Diagnostics"
+PluginsInstalled[] = "Login"
+PluginsInstalled[] = "CoreAdminHome"
+PluginsInstalled[] = "UsersManager"
+PluginsInstalled[] = "SitesManager"
+PluginsInstalled[] = "Installation"
+PluginsInstalled[] = "Monolog"
+PluginsInstalled[] = "Intl"
+PluginsInstalled[] = "CorePluginsAdmin"
+PluginsInstalled[] = "CoreHome"
+PluginsInstalled[] = "WebsiteMeasurable"
+PluginsInstalled[] = "IntranetMeasurable"
+PluginsInstalled[] = "CoreVisualizations"
+PluginsInstalled[] = "Proxy"
+PluginsInstalled[] = "API"
+PluginsInstalled[] = "Widgetize"
+PluginsInstalled[] = "Transitions"
+PluginsInstalled[] = "LanguagesManager"
+PluginsInstalled[] = "Actions"
+PluginsInstalled[] = "Dashboard"
+PluginsInstalled[] = "MultiSites"
+PluginsInstalled[] = "Referrers"
+PluginsInstalled[] = "UserLanguage"
+PluginsInstalled[] = "DevicesDetection"
+PluginsInstalled[] = "Goals"
+PluginsInstalled[] = "Ecommerce"
+PluginsInstalled[] = "SEO"
+PluginsInstalled[] = "Events"
+PluginsInstalled[] = "UserCountry"
+PluginsInstalled[] = "GeoIp2"
+PluginsInstalled[] = "VisitsSummary"
+PluginsInstalled[] = "VisitFrequency"
+PluginsInstalled[] = "VisitTime"
+PluginsInstalled[] = "VisitorInterest"
+PluginsInstalled[] = "RssWidget"
+PluginsInstalled[] = "Feedback"
+PluginsInstalled[] = "TwoFactorAuth"
+PluginsInstalled[] = "CoreUpdater"
+PluginsInstalled[] = "CoreConsole"
+PluginsInstalled[] = "ScheduledReports"
+PluginsInstalled[] = "UserCountryMap"
+PluginsInstalled[] = "Live"
+PluginsInstalled[] = "PrivacyManager"
+PluginsInstalled[] = "ImageGraph"
+PluginsInstalled[] = "Annotations"
+PluginsInstalled[] = "MobileMessaging"
+PluginsInstalled[] = "Overlay"
+PluginsInstalled[] = "SegmentEditor"
+PluginsInstalled[] = "Insights"
+PluginsInstalled[] = "Morpheus"
+PluginsInstalled[] = "Contents"
+PluginsInstalled[] = "BulkTracking"
+PluginsInstalled[] = "Resolution"
+PluginsInstalled[] = "DevicePlugins"
+PluginsInstalled[] = "Heartbeat"
+PluginsInstalled[] = "Marketplace"
+PluginsInstalled[] = "ProfessionalServices"
+PluginsInstalled[] = "UserId"
+PluginsInstalled[] = "CustomJsTracker"
+PluginsInstalled[] = "Tour"
+PluginsInstalled[] = "PagePerformance"
+PluginsInstalled[] = "CustomDimensions"
+
diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml
index a9e5f4249..66efc7861 100644
--- a/.docker/docker-compose.yml
+++ b/.docker/docker-compose.yml
@@ -1,4 +1,4 @@
-version: '3.1'
+version: "3.1"
services:
ember:
@@ -11,7 +11,7 @@ services:
- ../:/app:Z
- /app/node_modules
ports:
- - '${EMBER_PORT}:${EMBER_PORT}'
+ - "${EMBER_PORT}:${EMBER_PORT}"
networks:
- back
@@ -64,7 +64,7 @@ services:
- front
proxy:
- image: oapass/httpd-proxy:20200507@sha256:e8ad2e759fe270998efc80bdcacbeb3f965b4b83d875478e36b0ce4c104bb2d3
+ image: httpd-proxy:george
container_name: proxy
networks:
- front
@@ -178,6 +178,30 @@ services:
- front
- back
+ matomo:
+ image: matomo
+ container_name: matomo
+ env_file: .env
+ networks:
+ - front
+ - back
+ ports:
+ - 3299:80
+ volumes:
+ - /Users/georgepara/PASS/geepara-pass-ember/pass-ember/.docker/config.ini.php:/var/www/html/config/config.ini.php
+
+ db:
+ image: mariadb
+ container_name: mariadb
+ env_file: .env
+ ports:
+ - 3306:3306
+ networks:
+ - back
+ volumes:
+ - /Users/georgepara/PASS/mariadb:/var/lib/mysql
+
+
volumes:
passdata:
driver: local
diff --git a/.docker/httpd.conf b/.docker/httpd.conf
new file mode 100644
index 000000000..a56891378
--- /dev/null
+++ b/.docker/httpd.conf
@@ -0,0 +1,162 @@
+#Rewrite Rules
+#Force SSL
+RewriteEngine on
+ReWriteCond %{SERVER_PORT} !^443$
+RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
+
+ErrorLog /dev/stdout
+ErrorLogFormat "httpd-error [%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"
+LogLevel warn
+
+ServerName pass
+
+
+ DocumentRoot "/var/www/html"
+ AllowEncodedSlashes NoDecode
+
+ RewriteEngine on
+ RewriteCond %{REQUEST_URI} =/app
+ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1/ [NC,R,L]
+
+ SSLEngine on
+
+ #Disable CRIME vulernability v2.4+
+ SSLCompression off
+
+ #Clean SSL Issues and enable perfect forward secrecy
+ SSLProtocol all -SSLv2 -SSLv3 -TLSv1
+ SSLHonorCipherOrder on
+ SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 \
+EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 \
+EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"
+
+ #SSL Cert Stuff
+ SSLCertificateFile /etc/httpd/ssl/domain.crt
+ SSLCertificateKeyFile /etc/httpd/ssl/domain.key
+ #SSLCertificateChainFile /etc/httpd/ssl/serverchain.pem
+
+ SSLProxyEngine on
+ #Bypassing certicate checking on self-signed client cert
+ SSLProxyVerify none
+ SSLProxyCheckPeerCN off
+ SSLProxyCheckPeerName off
+ SSLProxyCheckPeerExpire off
+
+ ProxyPreserveHost on
+ RequestHeader set X-Forwarded-Proto "https" env=HTTPS
+ RequestHeader set REMOTE-USER %{REMOTE_USER}s
+ # Upgrade insecure requests, as an alternative to mod_substitute
+ # for http -> https url rewriting in response bodies.
+ #Header set Strict-Transport-Security "max-age=300"
+ #Header set Content-Security-Policy: upgrade-insecure-requests
+
+ Header set Access-Control-Max-Age "300"
+ # could be 'localhost', , ''
+ Header set Access-Control-Allow-Origin "*"
+ # allow cookies to be sent cross origin
+ Header set Access-Control-Allow-Credentials "true"
+ Header merge Access-Control-Allow-Methods "PUT, OPTIONS"
+ Header merge Access-Control-Expose-Headers "authorization"
+
+ #Map /idp to Tomcat
+ ProxyPass /idp https://idp:4443/idp
+ ProxyPassReverse /idp https://idp:4443/idp
+
+ ProxyPass /Shibboleth.sso http://sp/Shibboleth.sso
+ ProxyPassReverse /Shibboleth.sso http://sp/Shibboleth.sso
+
+ ProxyPass /pass-user-service http://sp/pass-user-service
+ ProxyPassReverse /pass-user-service http://sp/pass-user-service
+
+ ProxyPass /fcrepo http://sp/fcrepo
+ ProxyPassReverse /fcrepo http://sp/fcrepo
+
+ # Allow the pass Elasticsearch index to be searched as /es
+ # Convert private Fedora URIs returned by Elasticsearch to public URIs.
+
+ ProxyPass http://sp/es
+ ProxyPassReverse http://sp/es
+
+ # Needed for Substitute to work. Turns off compression.
+ RequestHeader unset Accept-Encoding
+
+ AddOutputFilterByType SUBSTITUTE application/json
+ Substitute "s|http://fcrepo:8080/fcrepo/rest/|https://pass.local/fcrepo/rest/|n"
+
+
+ # Allow DSpace to be addressed through the proxy
+ # Allows RepositoryCopy externalId to be resolved in various docker environments
+
+ ProxyPass http://dspace:8181/xmlui/
+ ProxyPassReverse http://dspace:8181/xmlui/
+
+ # Needed for Substitute to work. Turns off compression.
+ RequestHeader unset Accept-Encoding
+
+ AddOutputFilterByType SUBSTITUTE application/json
+ Substitute "s|http://dspace:8181/xmlui/|https://pass.local/xmlui/|n"
+
+
+
+ Header Set HTTP-X-FORWARDED-URI /matomo
+
+ # Matomo
+ ProxyPass http://matomo/
+ ProxyPassReverse https://pass.local/matomo/
+
+
+
+ # Ember app
+ ProxyPass /app http://sp/app
+ ProxyPassReverse /app http://sp/app
+
+ # Schema service
+ ProxyPass /schemaservice http://sp/schemaservice
+ ProxyPassReverse /schemaservice http://sp/schemaservice
+
+ # policy service
+ ProxyPass /policyservice http://sp/policyservice
+ ProxyPassReverse /policyservice http://sp/policyservice
+
+ # DOI service
+ ProxyPass /doiservice http://sp/doiservice
+ ProxyPassReverse /doiservice http://sp/doiservice
+
+ # OA Manuscript download service
+ ProxyPass /downloadservice http://sp/downloadservice
+ ProxyPassReverse /downloadservice http://sp/downloadservice
+
+ # Static pages
+ ProxyPass / http://static-html:82/
+ ProxyPassReverse / http://static-html:82/
+
+
+
+
+ #
+ # The following directives define some format nicknames for use with
+ # a CustomLog directive (see below).
+ #
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
+
+
+ # You need to enable mod_logio.c to use %I and %O
+ LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
+
+
+ #
+ # The location and format of the access logfile (Common Logfile Format).
+ # If you do not define any access logfiles within a
+ # container, they will be logged here. Contrariwise, if you *do*
+ # define per- access logfiles, transactions will be
+ # logged therein and *not* in this file.
+ #
+ #CustomLog "logs/access_log" common
+
+ #
+ # If you prefer a logfile with access, agent, and referer information
+ # (Combined Logfile Format) you can use the following directive.
+ #
+ CustomLog /dev/stdout "httpd-combined %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
+
diff --git a/CHANGES.md b/CHANGES.md
new file mode 100644
index 000000000..7063bb276
--- /dev/null
+++ b/CHANGES.md
@@ -0,0 +1,147 @@
+# Changes
+
+The goal of this branch is to implement usage statistics for PASS and keep user data safe.
+
+## Matomo
+
+Matomo was the data tracking platform of choice to implement this goal.
+Matomo was chosen because it is not linked to Google's analytics platform and the
+service can be hosted on one of our own servers.
+This ensures that users' information and data stay within the PASS system and has no
+contact with the internet or hosting companies.
+
+### Docker
+
+(https://hub.docker.com/_/matomo)
+
+In order to host matomo on our own servers, a matomo docker image is used.
+The command to run this docker image is:
+
+```bash
+docker run -d --link some-mysql:db matomo
+```
+
+The docker image was added to the docker-compose.yml file so that it runs with the
+other containers.
+It can be found in `.docker/docker-compose.yml` on lines 181-191:
+
+```yml
+matomo:
+ image: matomo
+ container_name: matomo
+ env_file: .env
+ networks:
+ - front
+ - back
+ ports:
+ - 3299:80
+ volumes:
+ - /pass-ember/.docker/config.ini.php:/var/www/html/config/config.ini.php
+```
+
+The container runs on port 80 (matomo specific).
+The container currently uses no environment variables but they can be added to `.docker/.env`.
+
+### Tracking code
+
+(https://developer.matomo.org/guides/tracking-javascript-guide)
+
+The matomo tracking code is a script added to the PASS web app in order to integrate matomo.
+The matomo tracking code was added to `index.html` on lines 15-29:
+
+```html
+
+
+
+```
+
+### Mariadb
+
+(https://hub.docker.com/_/mariadb)
+
+A mariadb database is used in order to store the data tracked by matomo.
+This database was configured as a docker container.
+The docker image was added to the docker-compose.yml file so that it runs with the other
+containers. It can be found in `.docker/docker-compose.yml` on lines 193-202:
+
+```yml
+db:
+ image: mariadb
+ container_name: mariadb
+ env_file: .env
+ ports:
+ - 3306:3306
+ networks:
+ - back
+ volumes:
+ - #path
+```
+
+The "path" comment can be replaced with the path of the mariadb database.
+The environment variables for the mariadb container can be found in `.docker/.env` on lines
+88-90:
+
+```yml
+# mariadb
+MYSQL_DATABASE=matomo
+MYSQL_ROOT_PASSWORD=hello
+```
+
+These environment variables are used on the matomo setup page in order to link the
+database to matomo.
+
+### Reverse Proxy
+
+When configuring the matomo docker container and attempting to access the matomo dashboard,
+we ran into a roadblock. Matomo, by default, uses `http` in order to access the login/dashboard.
+Chrome did not like the fact that matomo uses `http` and wanted it to use `https`. We attempted
+to fix this by using a reverse proxy in order to be able to use `https://pass.local/matomo`
+instead of `http://pass.local/matomo` to access the login/dashboard. This is the reason for the
+`httpd.conf` located in `.docker/`.
+
+### Matomo Setup
+
+The matomo setup and dashboard can be accessed by going to `http://pass.local/matomo`.
+Upon first installing matomo, a setup page will be displayed.
+Complete the setup by creating the matomo account used to access the dashboard and by
+linking the mariadb database.
+
+## Metrics Page
+
+Matomo is a good service for tracking metrics in terms of actual app usage.
+However, more specific metrics regarding data within PASS can not be gathered
+using Matomo. Therefore, a Metrics page was created within the pass web app
+itself.
+
+The page can be found on the main navigation bar when a user logs into PASS.
+It can also be found in the footer of any page in the PASS web app.
+
+In order to create this page, three files were created:
+ * `templates/metrics.hbs`
+ * `routes/metrics.js`
+ * `controllers/metrics.js`
+
+Virtually any metric that involves the actual data stored in PASS can be
+displayed here. There is one metric that is already implemented which is a
+list of the Journals and how many Submissions have been made per Journal.
+The metric is calculated in `routes/metrics.js`. I was unable to actually
+calculate the metric because the actual PASS data is inaccessible from my
+local copy of pass-ember. The test data does not have enough data in order
+to determine whether the calculation of the metric is working correctly or
+not.
\ No newline at end of file
diff --git a/app/components/nav-bar/index.hbs b/app/components/nav-bar/index.hbs
index 6564c9d80..647e4accb 100644
--- a/app/components/nav-bar/index.hbs
+++ b/app/components/nav-bar/index.hbs
@@ -25,6 +25,9 @@
FAQ
+
+ Metrics
+