LP1517298: Basic Matomo Analytics support for tt2 files
authorDan Scott <dan@coffeecode.net>
Wed, 3 Jul 2019 18:19:42 +0000 (11:19 -0700)
committerJason Boyer <JBoyer@equinoxinitiative.org>
Fri, 11 Sep 2020 20:13:09 +0000 (16:13 -0400)
Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Jason Boyer <JBoyer@equinoxinitiative.org>

Open-ILS/src/templates/opac/parts/base.tt2
Open-ILS/src/templates/opac/parts/matomo_analytics.tt2 [new file with mode: 0644]
docs/modules/admin_initial_setup/pages/designing_your_catalog.adoc
docs/modules/opac/pages/new_skin_customizations.adoc

index b6c2876..69210a5 100644 (file)
@@ -44,6 +44,7 @@
 
         [% IF !ctx.is_staff %]
             [% INCLUDE 'opac/parts/goog_analytics.tt2' %]
+            [% INCLUDE 'opac/parts/matomo_analytics.tt2' %]
         [% END %]
         [% PROCESS 'opac/parts/stripe.tt2' %]
     </head>
diff --git a/Open-ILS/src/templates/opac/parts/matomo_analytics.tt2 b/Open-ILS/src/templates/opac/parts/matomo_analytics.tt2
new file mode 100644 (file)
index 0000000..5f2ffd8
--- /dev/null
@@ -0,0 +1,18 @@
+[%- PROCESS "opac/parts/header.tt2";
+    IF matomo_analytics.enabled == 'true' -%]
+<!-- Matomo -->
+<script type="text/javascript">
+  var _paq = window._paq || [];
+  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
+  _paq.push(['trackPageView']);
+  _paq.push(['enableLinkTracking']);
+  (function() {
+    var u="[% matomo_analytics.url %]";
+    _paq.push(['setTrackerUrl', u+'matomo.php']);
+    _paq.push(['setSiteId', '[% matomo_analytics.site %]']);
+    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+  })();
+</script>
+<!-- End Matomo Code -->
+[%- END -%]
index 43b8ffc..128f6af 100644 (file)
@@ -541,6 +541,19 @@ will need to edit _config.tt2_ in your template. To enable the service set
 the value of google_analytics.enabled to true and change the value of 
 _google_analytics.code_ to be the code in your Google Analytics account.
 
+=== Matomo Analytics ===
+
+Matomo Analytics (https://matomo.org/) is free software that you can host
+yourself, so that you can collect web site statistics without sharing your
+users' data with third parties.  Statistic tracking is disabled by default
+through the Evergreen client software when library staff use your site within
+the client, but active when anyone uses the site without the client.  This was
+a preventive measure to reduce the potential risks for leaking patron
+information. To use Matomo Analytics you need to:
+
+. Set up a hosted instance of Matomo
+. Add your Evergreen catalogue as a site
+
 === NoveList ===
 
 Novelist is a subscription-based service providing reviews and recommendation
index 2e78729..47ebef0 100644 (file)
@@ -47,7 +47,7 @@ NOTE: All paths are relative to `/openils/var/templates/opac`
   ** hiding the *Place Hold* button for available items
   ** enabling RefWorks support for citation management
   ** adding OpenURL resolution for electronic resources
-  ** enabling Google Analytics tracking for your TPAC
+  ** enabling Google Analytics or Matomo Analytics tracking for your TPAC
   ** displaying the "Forgot your password?" prompt
   ** controlling the size of cover art on the record details page
   ** defining which facets to display, and in which order