From 8ae9bd77cb763ec56dc8cf09da8b14e4987f41a1 Mon Sep 17 00:00:00 2001 From: B0r1sD Date: Wed, 26 Aug 2026 14:28:51 +0200 Subject: [PATCH] feat: cookieless matomo integration (untested) --- doc/source/admin/galaxy_options.rst | 14 ++++++++++++++ .../config/_galaxy_config_schema_attributes.py | 1 + lib/galaxy/config/sample/galaxy.yml.sample | 7 +++++++ lib/galaxy/config/schemas/config_schema.yml | 11 +++++++++++ templates/js-app.mako | 7 +++++-- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/doc/source/admin/galaxy_options.rst b/doc/source/admin/galaxy_options.rst index ce37cc4fe7a..389613bbb82 100644 --- a/doc/source/admin/galaxy_options.rst +++ b/doc/source/admin/galaxy_options.rst @@ -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`` ~~~~~~~~~~~~~~~~~~~ diff --git a/lib/galaxy/config/_galaxy_config_schema_attributes.py b/lib/galaxy/config/_galaxy_config_schema_attributes.py index 42f071d66d1..ef9a4e53b14 100644 --- a/lib/galaxy/config/_galaxy_config_schema_attributes.py +++ b/lib/galaxy/config/_galaxy_config_schema_attributes.py @@ -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 diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index 619d45bca3c..b10eaa4dcf3 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -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. diff --git a/lib/galaxy/config/schemas/config_schema.yml b/lib/galaxy/config/schemas/config_schema.yml index 14e76a23008..0b7dc031d82 100644 --- a/lib/galaxy/config/schemas/config_schema.yml +++ b/lib/galaxy/config/schemas/config_schema.yml @@ -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 diff --git a/templates/js-app.mako b/templates/js-app.mako index 6ccceeef0f8..d89c28a5378 100644 --- a/templates/js-app.mako +++ b/templates/js-app.mako @@ -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 @@ -93,13 +93,16 @@ %endif -<%def name="config_matomo_analytics(matomo_server, matomo_site_id)"> +<%def name="config_matomo_analytics(matomo_server, matomo_site_id, matomo_disable_cookies=True)">