Skip to content

Commit 2866fc6

Browse files
author
jazairi
committed
Add unique setup instructions for Matomo
Why these changes are being introduced: As we add different types of properties to Matomo, we should update the docs to explain how to set up Matomo in them. Relevant ticket(s): https://mitlibraries.atlassian.net/browse/UXWS-1563 How this addresses that need: This adds instructions on how to set up Matomo in the WP Pantheon network, LibApps, and static sites. It also stubs out the instructions for Dome and DSpace, which have not yet been configured for Matomo. Side effects of this change: We'll need to do update the docs again once Dome and DSpace are unblocked.
1 parent e4e1d50 commit 2866fc6

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

misc/matomo.md

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Each app is tracked as a website in Matomo. Please create a different
2323
website for each environment of your application (e.g., staging and prod
2424
will be separate websites in Matomo).
2525

26-
_Note: Accounts with superuser permissions add new websites to Matomo.
26+
_Note: Accounts with superuser permissions can add new websites to Matomo.
2727
If you don’t have superuser access, ask EngX._
2828

2929
1. Log into Matomo at https://analytics-prod.mitlib.net. (There is also
@@ -58,15 +58,51 @@ trailing forward slash!
5858
find this in Matomo by going to Settings (gearbox icon in navbar) > Websites
5959
> Manage. The ID for each website will appear underneath the website name.
6060
61-
### For other applications
61+
### For the WordPress network hosted on Pantheon
6262

63-
We don’t yet have a procedure for non-Rails apps. You will need to add
64-
the Matomo tracking JS (found in Settings > Websites > Tracking Code) to
65-
your app directly.
63+
The [mitlib-analytics plugin](https://github.com/MITLibraries/mitlib-wp-network/tree/master/web/app/plugins/mitlib-analytics)
64+
inserts Matomo tracking code into the network. The plugin has two config values -- Matomo URL and Matomo property ID --
65+
both of which can be set in the network admin console.
6666

67-
Confirm that tracking is working by visiting your site, clicking a few
68-
links, and making sure this activity was recorded in the Matomo dashboard.
69-
Also make sure that IPs are anonymized (they should be, but make sure anyway).
67+
Note that we collect data for libraries.mit.edu and LibGuides in the same Matomo property, so these will use the same
68+
property ID.
69+
70+
### For LibGuides and another LibApps products
71+
72+
We track LibGuides on the same Matomo property as the WordPress network. Since there is no staging or dev environment in LibApps, we need to make the changes live in prod by adding/editing tracking code in the header.
73+
74+
The
75+
[hosted-branding repo](https://github.com/MITLibraries/hosted-branding) details how to modify LibApps headers. Once you
76+
have made changes, make sure to check the updated header markup into the hosted-branding repo.
77+
78+
If you'd like to test changes before they go live, we have a
79+
[test group in LibGuides](https://libguides.mit.edu/test-group) that has its own header/footer and JS/CSS. The test
80+
group has minimal content, but you should be able to discern whether tracking data is being sent to Matomo.
81+
82+
### For static sites
83+
84+
The [mitlib-tf-workloads-libraries-website](https://github.com/mitlibraries/mitlib-tf-workloads-libraries-website) repo
85+
builds a CDN for static content. Typically, this is infrastructure is used for legacy sites like
86+
[Future of Libraries](https://github.com/MITLibraries/future-of-libraries-static).
87+
88+
Matomo needs to be set up differently for these sites in order to accommodate the CSP directives for the CDN. As
89+
described in [this FAQ](https://matomo.org/faq/general/faq_20904/), the tracking code should be loaded from the site's
90+
assets directory (rather than inline), and the client script should be loaded explicitly (rather than from the tracking
91+
code).
92+
93+
For Future of Libraries, and likely for other static sites, these `script` tags will have to be added to the `head` of
94+
each HTML file in the site. The best way we've found to do this is find/replace in your IDE, which feels adequate for a one-time process. If we find that we need to edit the script tags often, then a find/replace script may be useful.
95+
96+
### For DSpace@MIT
97+
98+
The DSpace@MIT codebase is hosted on Atmire's GitLab organization. In order to add or modify tracking code, you will
99+
need a GitLab account. As of June 2023, the Digital Library Systems Manager is our point of contact with Atmire.
100+
101+
_More details to be added once we've configured Matomo in DSpace@MIT._
102+
103+
### For Dome
104+
105+
TBD, pending migration of Dome to our AWS org.
70106

71107
## Other things to note
72108

0 commit comments

Comments
 (0)