Skip to content

Commit 071dd9e

Browse files
authored
Merge pull request #58 from MITLibraries/uxws-1563-matomo-doc-updates
Add unique setup instructions for Matomo
2 parents 065ecc6 + 7244afd commit 071dd9e

File tree

1 file changed

+43
-7
lines changed

1 file changed

+43
-7
lines changed

misc/matomo.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,51 @@ Heroku app:
2424
find this in Matomo by going to Settings (gearbox icon in navbar) > Websites > Manage. The ID for each website will
2525
appear underneath the website name.
2626

27-
## For other applications
27+
## For the WordPress network hosted on Pantheon
2828

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

33-
Confirm that tracking is working by visiting your site, clicking a few
34-
links, and making sure this activity was recorded in the Matomo dashboard.
35-
Also make sure that IPs are anonymized (they should be, but make sure anyway).
33+
Note that we collect data for libraries.mit.edu and LibGuides in the same Matomo property, so these will use the same
34+
property ID.
35+
36+
## For LibGuides and another LibApps products
37+
38+
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.
39+
40+
The
41+
[hosted-branding repo](https://github.com/MITLibraries/hosted-branding) details how to modify LibApps headers. Once you
42+
have made changes, make sure to check the updated header markup into the hosted-branding repo.
43+
44+
If you'd like to test changes before they go live, we have a
45+
[test group in LibGuides](https://libguides.mit.edu/test-group) that has its own header/footer and JS/CSS. The test
46+
group has minimal content, but you should be able to discern whether tracking data is being sent to Matomo.
47+
48+
## For static sites
49+
50+
The [mitlib-tf-workloads-libraries-website](https://github.com/mitlibraries/mitlib-tf-workloads-libraries-website) repo
51+
builds a CDN for static content. Typically, this is infrastructure is used for legacy sites like
52+
[Future of Libraries](https://github.com/MITLibraries/future-of-libraries-static).
53+
54+
Matomo needs to be set up differently for these sites in order to accommodate the CSP directives for the CDN. As
55+
described in [this FAQ](https://matomo.org/faq/general/faq_20904/), the tracking code should be loaded from the site's
56+
assets directory (rather than inline), and the client script should be loaded explicitly (rather than from the tracking
57+
code).
58+
59+
For Future of Libraries, and likely for other static sites, these `script` tags will have to be added to the `head` of
60+
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.
61+
62+
## For DSpace@MIT
63+
64+
The DSpace@MIT codebase is hosted on Atmire's GitLab organization. In order to add or modify tracking code, you will
65+
need a GitLab account. As of June 2023, the Digital Library Systems Manager is our point of contact with Atmire.
66+
67+
_More details to be added once we've configured Matomo in DSpace@MIT._
68+
69+
## For Dome
70+
71+
TBD, pending migration of Dome to our AWS org.
3672

3773
## Other things to note
3874

0 commit comments

Comments
 (0)