Disabled "Do not track" checkbox will not be passed to the script and falls back to Matomo server defaults

Created on 28 October 2022, over 1 year ago
Updated 24 July 2023, 11 months ago

Problem/Motivation

In matomo plugins/PrivacyManager/DoNotTrackHeaderChecker.php isDoNotTrackFound() always seems to return true so no recording is done.
Matomo server is v4.12.0

In Drupal module config I have:
/Privacy\
Universal web tracking opt-out is off
/Users\
No customization allowed - selected
Track User ID is on

Steps to reproduce

Setup as above, switch on debugging in matomo - to log
Add a debug line at top of isDoNotTrackFound() eg:
Common::printDebug("isDoNotTrackFound() isActive=" . $this->isActive());
Load a page on your configured site
The Matomo log will show 1 and no entry on Matomo Admin UI

Add return false; after debug line
try another page
this is now recorded

Proposed resolution

I'm not sure if this is a Matomo server problem, or if this module is sending the wrong settings to Matomo

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Jons

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    I think the problem is, that the Matomo Drupal Module only passes the `setDoNotTrack` setting to Matomo, if it is enabled. It's implemented in https://git.drupalcode.org/project/matomo/-/blob/8.x-1.x/matomo.module?r...

    In that case (and only if the checkbox is disabled) it will fallback to the global "Do not track" setting you have configured in Matomo itself. That is by default respecting the "Do not track" Header and therefore would not collect data for users having the option enabled in their browser.

    It's a bit confusing, because the site manager in Drupal would expect that the checkbox setting has a direct consequence, no matter the global setting on the Matomo server is.

    I would recommend to explicitly pass the setting to Matomo always like configured in the Drupal backend. This will be clearer and leads to no surprises for that matter.

  • Status changed to Needs review 11 months ago
  • Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Here's a patch for it. It always will set the following based on the checkbox configured in the Drupal Matomo settings form.

    _paq.push(["setDoNotTrack", "true"]
    

    or

    _paq.push(["setDoNotTrack", "false"]
    

    Then the tracking will always respect the configuration of the module and not invoke the Matomo default settings.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Hm, apparently according to my first test, Matomo still falls back to the Matomo server setting.

  • Status changed to Active 11 months ago
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin
  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Apparently the DNT support gets deprecated in Matomo 5. So it might be absolutely alright to already ditch the support in your installation by disabling the feature globally in the the Matomo server configuration. https://matomo.org/changelog/matomo-5-0-0-beta/

  • πŸ‡¬πŸ‡§United Kingdom Jons

    thanks, I'll have a look

Production build 0.69.0 2024