feat: cookieless matomo integration (untested)

This commit is contained in:
B0r1sD
2026-08-26 14:28:51 +02:00
parent 21e0648b63
commit 8ae9bd77cb
5 changed files with 38 additions and 2 deletions
+14
View File
@@ -2144,6 +2144,20 @@
:Type: str
~~~~~~~~~~~~~~~~~~~~~~~~~~
``matomo_disable_cookies``
~~~~~~~~~~~~~~~~~~~~~~~~~~
:Description:
Run Matomo in "cookieless" mode. When set to true (the default),
Galaxy instructs the Matomo tracker to disable all tracking
cookies by calling _paq.push(['disableCookies']) before tracking
the page view. Set to false to allow Matomo to use cookies. See
https://matomo.org/faq/general/faq_157/ for details.
:Default: ``true``
:Type: bool
~~~~~~~~~~~~~~~~~~~
``display_servers``
~~~~~~~~~~~~~~~~~~~
@@ -165,6 +165,7 @@ class GalaxyAppConfigurationAttributes:
plausible_domain: str | None
matomo_server: str | None
matomo_site_id: str | None
matomo_disable_cookies: bool
display_servers: str
enable_old_display_applications: bool
aws_estimate: bool
@@ -1426,6 +1426,13 @@ galaxy:
# for tracking with Matomo (https://matomo.org/).
#matomo_site_id: null
# Run Matomo in "cookieless" mode. When set to true (the default),
# Galaxy instructs the Matomo tracker to disable all tracking cookies
# by calling _paq.push(['disableCookies']) before tracking the page
# view. Set to false to allow Matomo to use cookies. See
# https://matomo.org/faq/general/faq_157/ for details.
#matomo_disable_cookies: true
# Galaxy can display data at various external browsers. These options
# specify which browsers should be available. URLs and builds
# available at these browsers are defined in the specified files.
@@ -1605,6 +1605,17 @@ mapping:
Please enter the site ID for the Matomo server so this can be used for tracking
with Matomo (https://matomo.org/).
matomo_disable_cookies:
type: bool
default: true
required: false
desc: |
Run Matomo in "cookieless" mode. When set to true (the default), Galaxy
instructs the Matomo tracker to disable all tracking cookies by calling
_paq.push(['disableCookies']) before tracking the page view. Set to false
to allow Matomo to use cookies. See
https://matomo.org/faq/general/faq_157/ for details.
display_servers:
type: str
default: hgw1.cse.ucsc.edu,hgw2.cse.ucsc.edu,hgw3.cse.ucsc.edu,hgw4.cse.ucsc.edu,hgw5.cse.ucsc.edu,hgw6.cse.ucsc.edu,hgw7.cse.ucsc.edu,hgw8.cse.ucsc.edu,lowepub.cse.ucsc.edu
+5 -2
View File
@@ -61,7 +61,7 @@
${ config_plausible_analytics(app.config.plausible_server, app.config.plausible_domain) }
%endif
%if app.config.matomo_server and app.config.matomo_site_id:
${ config_matomo_analytics(app.config.matomo_server, app.config.matomo_site_id) }
${ config_matomo_analytics(app.config.matomo_server, app.config.matomo_site_id, app.config.matomo_disable_cookies) }
%endif
</body>
</html>
@@ -93,13 +93,16 @@
%endif
</%def>
<%def name="config_matomo_analytics(matomo_server, matomo_site_id)">
<%def name="config_matomo_analytics(matomo_server, matomo_site_id, matomo_disable_cookies=True)">
<script type="text/javascript">
console.log("config_matomo_analytics matomo_server:", '${matomo_server}');
console.log("config_matomo_analytics matomo_site_id:", '${matomo_site_id}')
%if matomo_server and matomo_site_id:
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
%if matomo_disable_cookies:
_paq.push(['disableCookies']);
%endif
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {