Catalogue should support Matomo, a privacy-sensitive alternative to Google Analytics

Bug #1517298 reported by Dan Scott on 2015-11-18
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Wishlist
Unassigned

Bug Description

Evergreen currently supports Google Analytics for generating statistics on browser usage, number of hits, etc.

Rather than putting patron data in the hands of a third party, it would be nice to support Piwik, which is a self-hosted alternative that can provide many of the same statistics. This also has the advantage of avoiding privacy blockers that block the Google Analytics domain and prevent statistics from being compiled.

Agreed. This is something already on my formal board assigned list of
things to implement for SCLENDS though it'd be nice if it were a clean
feature of Evergreen rather than a TPAC customization.

On Tue, Nov 17, 2015 at 10:35 PM, Dan Scott <email address hidden> wrote:

> Public bug reported:
>
> Evergreen currently supports Google Analytics for generating statistics
> on browser usage, number of hits, etc.
>
> Rather than putting patron data in the hands of a third party, it would
> be nice to support Piwik, which is a self-hosted alternative that can
> provide many of the same statistics. This also has the advantage of
> avoiding privacy blockers that block the Google Analytics domain and
> prevent statistics from being compiled.
>
> ** Affects: evergreen
> Importance: Wishlist
> Status: New
>
>
> ** Tags: privacy
>
> --
> You received this bug notification because you are subscribed to
> Evergreen.
> Matching subscriptions: evergreenbugs
> https://bugs.launchpad.net/bugs/1517298
>
> Title:
> Catalogue should support Piwik, a privacy-sensitive alternative to
> Google Analytics
>
> Status in Evergreen:
> New
>
> Bug description:
> Evergreen currently supports Google Analytics for generating
> statistics on browser usage, number of hits, etc.
>
> Rather than putting patron data in the hands of a third party, it
> would be nice to support Piwik, which is a self-hosted alternative
> that can provide many of the same statistics. This also has the
> advantage of avoiding privacy blockers that block the Google Analytics
> domain and prevent statistics from being compiled.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/evergreen/+bug/1517298/+subscriptions
>

As an example, here's how Sitka added Piwik support to our OPAC:

http://git.sitka.bclibraries.ca/gitweb/?p=sitka/evergreen.git;a=commitdiff;h=955954e

This is just a lightly modified version of the JS tracking code from the Piwik documentation:

https://developer.piwik.org/guides/tracking-javascript-guide

Dan Scott (denials) wrote :

Piwik has evolved into Matomo (https://matomo.org/). Otherwise, the goal is the same.

I agree with Rogan that it would be preferable to have the Matomo URL, site ID, and enablement all parameters that could be configured via Library Settings, but that takes more work to implement.

So for a quick and dirty approach, I've gone with the TPAC customization approach for a branch that allows customization via config.tt2 (just like the Google Analytics approach).

See the working/user/dbs/matomo_analytics branch (https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbs/matomo_analytics)

summary: - Catalogue should support Piwik, a privacy-sensitive alternative to
+ Catalogue should support Matomo, a privacy-sensitive alternative to
Google Analytics
Dan Scott (denials) wrote :

Well I included docs so I guess it's not that quick and dirty :)

Dan Scott (denials) wrote :

To do things the Library Settings way, we can:

* use Open-ILS/src/templates/opac/parts/library/core_info.tt2 as a template for how to grab an OU setting in TT2
* the last INSERT in Open-ILS/src/sql/Pg/upgrade/1047.schema.copy_tags.sql as a template for how to add a library setting for an OPAC feature

(notes primarily for my own use, to save time tracking down in the future)

Rogan Hamby (rogan-hamby) wrote :

I've got a branch working using library org settings. I need to do a bit more testing but I will post a branch for it later today.

Changed in evergreen:
assignee: nobody → Rogan Hamby (rogan-hamby)
Rogan Hamby (rogan-hamby) wrote :
tags: added: pullrequest
Changed in evergreen:
assignee: Rogan Hamby (rogan-hamby) → nobody
Jane Sandberg (sandbej) on 2020-08-18
Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbej)
Jane Sandberg (sandbej) wrote :

Thanks, Jeff, Dan, and Rogan. Rogan, I tried your branch, and it definitely worked. I was able to track a bunch of movements using a free trial Matomo dashboard -- very cool.

Before signing off, there are a few changes I'd want to see:
* Requiring 3 different permissions to get this thing rolling seems excessive to me. Could we please just use a single permission?
* On a similar note, I'd prefer to just have two org unit settings: opac.analytics.matomo_id and opac.analytics.matomo_url. Rather than checking for a third org unit setting, the tt2 could just check for the presence of these two org unit settings. This would reduce a step to get this feature running, and save an entry in an already huge list of org settings. Plus, it doesn't make much sense to enable this feature without a site id or a url. I could be convinced, though.
* Some light rebasing needed in the seed data, as always. :-)
* Can I propose some new description text for opac.analytics.matomo_id and opac.analytics.matomo_url?

  -> opac.analytics.matomo_id: The Site ID for your Evergreen catalog. You can find the Site ID in the tracking code you got from Matomo.
  -> opac.analytics.matomo_url: The URL for your the Matomo software. Be sure to include the trailing slash, e.g. https://my-evergreen.matomo.cloud/

I'd be happy to take these on, if there is agreement about them.

Changed in evergreen:
assignee: Jane Sandberg (sandbej) → nobody
Jane Sandberg (sandbej) wrote :

...and one more note: after this and bug 1778972 are both merged, we'll need to add the small opac/parts/base.tt2 change to the bootstrap version as well.

It has been a long time since I've looked at the branch and have no strong
feelings about. Whatever makes for better code is fine with me. So, if
you're looking for blessing with tweaking something I've done go for it.

On Tue, Aug 18, 2020 at 7:49 PM Jane Sandberg <email address hidden>
wrote:

> ...and one more note: after this and bug 1778972 are both merged, we'll
>
> need to add the small opac/parts/base.tt2 change to the bootstrap
>
> version as well.
>
>
>
> --
>
> You received this bug notification because you are a member of Evergreen
>
> Bug Wranglers, which is subscribed to Evergreen.
>
> Matching subscriptions: evergreenbugs
>
> https://bugs.launchpad.net/bugs/1517298
>
>
>
> Title:
>
> Catalogue should support Matomo, a privacy-sensitive alternative to
>
> Google Analytics
>
>
>
> Status in Evergreen:
>
> New
>
>
>
> Bug description:
>
> Evergreen currently supports Google Analytics for generating
>
> statistics on browser usage, number of hits, etc.
>
>
>
> Rather than putting patron data in the hands of a third party, it
>
> would be nice to support Piwik, which is a self-hosted alternative
>
> that can provide many of the same statistics. This also has the
>
> advantage of avoiding privacy blockers that block the Google Analytics
>
> domain and prevent statistics from being compiled.
>
>
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/evergreen/+bug/1517298/+subscriptions
>
>

Jane Sandberg (sandbej) wrote :

Thanks, Rogan!

I've taken the best of Dan's and Rogan's branches, added the changes I mentioned above, and the result is at user/sandbergja/lp1517298_matomo

Changed in evergreen:
milestone: 3.next → 3.6-beta
Changed in evergreen:
assignee: nobody → Rogan Hamby (rogan-hamby)
Changed in evergreen:
assignee: Rogan Hamby (rogan-hamby) → nobody
tags: added: signedoff
tags: removed: signedoff
Rogan Hamby (rogan-hamby) wrote :

Hi Jane,

I'm having some issues with the simplified branch. I'm getting some merge conflicts and maybe the issue is on my end but the end result is that the reference calling matomo_analytics.tt2 is gone from base.tt2 and I'm not seeing anything else that would serve that function. Was that intentional?

Jane Sandberg (sandbej) wrote :

Thanks for taking a look, Rogan. Did you happen to grab all three commits from my branch? If so, matomo_analytics.tt2 should be called in parts/base.tt2, right next to the google analytics include, a la Dan's branch: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=blob;f=Open-ILS/src/templates/opac/parts/base.tt2;h=835c6723ba4e01112e07b6acd0f4a662b2b03fdc;hb=e17d8a591abd6c56ec22a607333447348de836c3#l53

Rogan Hamby (rogan-hamby) wrote :

Hi Jane,

I did a range for commits but might not have been grabbing the last one. I'll check.

Rogan Hamby (rogan-hamby) wrote :

Okay, I think I did miss one of the commits.

Aside from cleaning up some merge conflicts in the seed data it worked. I pushed a signoff to user/rogan/lp1517298_matomo_signoff.

tags: added: signedoff
Jason Boyer (jboyer) on 2020-09-11
Changed in evergreen:
assignee: nobody → Jason Boyer (jboyer)
Jason Boyer (jboyer) wrote :

I ran this through one last round of cleanup and changed the permission name to match other org setting permissions (UPDATE_ORG_UNIT_SETTING.opac.matomo) and pushed it to master for release in 3.6. Thanks everyone!

Changed in evergreen:
assignee: Jason Boyer (jboyer) → nobody
status: New → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers