Skip to content

Commit c097476

Browse files
author
Adam Jazairi
authored
Merge pull request #4 from MITLibraries/update-docs
Add documentation to readme
2 parents 4aa9584 + cf37a67 commit c097476

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

README.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,78 @@
1-
# docker matomo analytics
1+
# Search Analytics (Matomo)
2+
3+
This repository supports MIT Libraries' implementation of (Matomo)[https://matomo.org/],
4+
which we use to collect discovery analytics. Our implementation uses the Docker
5+
container provided by Matomo. We host the application in AWS Fargate.
6+
7+
## Building
8+
9+
Run `make build` to create a new container tagged as `analytics-stage:latest`.
10+
11+
## Deploying
12+
13+
Run `make dist` to build, tag, and push a container to staging. To promote to
14+
production, run `make publish`.
15+
16+
Please see the corresponding (Terraform module)[https://github.com/MITLibraries/mitlib-terraform/tree/master/apps/analytics] for deployment config.
17+
18+
## URLs
19+
20+
- Staging: analytics-stage.mitlib.net (MIT VPN access only)
21+
- Production: analytics-prod.mitlib.net
22+
23+
## Implementation notes
24+
25+
### PHP configuration file
26+
27+
`config.ini.php` file contains some basic Matomo configuration. There are a
28+
couple of sections worth addressing:
29+
30+
1. The `Plugins` section tells Matomo which plugins to enable on installation.
31+
To disable a plugin, simply remove it from this section. Our preference is to
32+
modify this section and not the `PluginsInstalled` section, as removing a
33+
plugin from `PluginsInstalled` would remove it from the application completely.
34+
2. The `mail` section configures the SMTP server. Matomo uses mailers for
35+
several core functions, including password resets and reporting. Some related
36+
config values (e.g., `login_password_recovery_email_address`) are defined in
37+
the `General` section.
38+
39+
When deploying from scratch, we noticed that the initial Matomo setup in the GUI
40+
seems to overwrite our config. As a result, it may be necessary on rare occasion
41+
to spin up an EC2 instance to touch the config file directly. So far, we've
42+
only had to do this after the initial deploy, so it's unlikely to come up often.
43+
44+
### Data anonymization
45+
46+
We anonymize tracking data to protect our users' privacy. Specifically, we mask
47+
two bytes of visitors' IPs (e.g., 192.186.x.x), and we have disabled [Matomo's
48+
User ID plugin](https://matomo.org/docs/user-id/).
49+
50+
Before promoting a new build to production, ensure that IPs are anonymized by
51+
visiting Administration -> Privacy -> Anonymize data in the GUI. (You shouldn't
52+
ever need to modify these settings, but it's important to verify as part of the
53+
deploy process.)
54+
55+
### Archiving reports
56+
57+
Matomo calls the process by which it compiles raw log data into human-readable
58+
report 'archiving'. By default, archiving occurs on demand, whenever a Matomo
59+
user attempts to view a report in the GUI. Based on [Matomo's recommendation](https://matomo.org/docs/setup-auto-archiving/), we have configured a cron job to archive reports every
60+
hour.
61+
62+
The cron job runs as a scheduled ECS task and is defined in the
63+
[Terraform config](https://github.com/MITLibraries/mitlib-terraform/tree/master/apps/analytics).
64+
65+
### Authentication
66+
67+
The superuser account can create and manage user
68+
accounts in the GUI (Administration -> System -> Users). After creating a new
69+
account, the superuser should notify the account holder. The account holder
70+
can then reset their password by clicking the 'Lost your password?' link on the
71+
Matomo sign-in page.
72+
73+
We generally assign the 'View' role to new users, unless they require a higher
74+
permissions level.
75+
76+
Matomo has built-in two-factor authentication, which we enforce for all accounts.
77+
When a user logs in to Matomo for the first time, they will be prompted to
78+
configure 2FA. At this time, we are recommending Duo as an authenticator.

0 commit comments

Comments
 (0)