Problem/Motivation
Uncaught TypeError: drupalSettings.matomo is undefined
In matomo.module in function:
function matomo_page_attachments(array &$page) {
we have:
if ((_matomo_visibility_pages() || in_array($status, $trackable_status_codes)) && _matomo_visibility_user($account)) {
in that if: "trackMailto" is set.
Thus when javascript tries to check for drupalSettings.matomo.trackMailto inside of matomo.js this error gets triggered?
Steps to reproduce
Drupal 10 + Js aggregation.
When editing a block on a layout builder page > this error is triggered.
Proposed resolution
Check if the variable exists (or set it by default?)
Remaining tasks
Review
Issue fork matomo-3436780
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mschudders commentedmerge request provided
Comment #4
grimreaperComment #5
grimreaperStrange because the only time the "matomo/matomo" library is added on the page, it is in this if statement too.
So the drupalSettings should be also. present.
I will try another approach with putting default settings into the library.yml.
Comment #8
grimreaper