Problem/Motivation

Starting with the automated compatibility fixes, I tried to make the module Drupal 11 ready,
actually I'm wondering that there is still not working patch for it, but may be I'm just did not find it?

Remaining tasks

Fix the remainig deprecations

User interface changes

NONE

API changes

NONE

Data model changes

NONE

CommentFileSizeAuthor
#3 UpdateMatomo4Drupal11-3546318-3.patch8.2 KBmmbk

Issue fork matomo-3546318

Command icon 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

mmbk created an issue. See original summary.

mmbk’s picture

Assigned: mmbk » Unassigned
mmbk’s picture

StatusFileSize
new8.2 KB

mmbk’s picture

Status: Active » Needs review
mmbk’s picture

Status: Needs review » Needs work

Hmm… I don't understand that error, locally the test succeeds.

The test tests whether the matomo.js is loaded, if not the whole module should not work, but in my project, everything is tracked correctly.

jamesoakley’s picture

What error did you get? I'm not seeing it

Are all of the changes in this patch to do with Drupal 11 readiness, or are some of them other pieces of tidying up.

I'm looking at sections of the patch like

-          vals.push($.trim($(this).next('label').text()));
+          vals.push($(this).next('label').text());

and

-  public function pageTrackingProvider(): array {
+  public static function pageTrackingProvider(): array {
mmbk’s picture

I changed all things that were complained by rector, so yes, it's D11 related.

The error was in the pipeline

jamesoakley’s picture

Status: Needs work » Reviewed & tested by the community

I have applied this patch, and was able to upgrade from Drupal 10 to Drupal 11. The module correctly serves up the tracking code in the HEAD area of the HTML, and the admin area works fine.

I'd say that this patch can safely be applied to 8.x-1.x, and a new release tagged as compatible with Drupal 11.

Then people do not need for the 2.x branch of this module to be ready before they can use Matomo with Drupal 11.

j-lee’s picture

The error from the test says:

Drupal\Tests\matomo\Functional\MatomoBasicTest::testMatomoPageVisibility
Behat\Mink\Exception\ExpectationException: The string "/matomo/js/matomo.js" was not found anywhere in the HTML response of the current page.
/builds/issue/matomo-3546318/vendor/behat/mink/src/WebAssert.php:888
/builds/issue/matomo-3546318/vendor/behat/mink/src/WebAssert.php:363
/builds/issue/matomo-3546318/web/core/tests/Drupal/Tests/WebAssert.php:558
/builds/issue/matomo-3546318/tests/src/Functional/MatomoBasicTest.php:114
/builds/issue/matomo-3546318/vendor/phpunit/phpunit/src/Framework/TestResult.php:729

I don't think, this has to do with the MR.

jamesoakley’s picture

Ah, I see.

That's because, if you look at the tracking code to insert given by Matomo, you get this snippet:

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://{matomo-site}domain}";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '{supply-here}']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

So the string "/matomo/js/matomo.js" won't be found in the page HTML.

This module follows that, and inserts u+'matomo.js' into the page (it's in matomo.module). Looking through the commit history, that's been so at least as far back at 2019, then I stopped looking.

So the problem is the test, not the code. As far as I can see, that's also been the way it is for ages.

So I doubt this test failure is new, and it certainly isn't something that works fine with Drupal 10 but fails for Drupal 11.

So I'd still say that the 8.x-1.x branch of this module can safely be released to support Drupal 11.

j-lee’s picture

Thanks jamesoakley. Still RTBC. Maybe a maintainer can look into this?
Would be nice to have this in a release.

c-logemann’s picture

It's wrong that there is no D11 version of Matomo module. But this in in Branch/Version 2.x which is currently not stable yet. I think the plan was to make Version 2 stable and mark 8.1.x unsupported. Because you did this probably not needed extra work on the old branch it make sense to take a look into it. But even if we commit and maybe do a new stable release did not mean that we will support this version longer when version 2.x gets a stable release.

c-logemann’s picture

In any case you are invited to help e.g. with testing to get version 2 stable.

c-logemann’s picture

Title: Manual Drupal 11 compatibility fixes for matomo » Manual Drupal 11 compatibility fixes for matomo 8.x-1.x
c-logemann’s picture

@mmbk Next time please go on with the existing issue. It was not needed to create this one.

jamesoakley’s picture

Hi Carsten, thanks for reviewing this.

I can see that the 2.x branch is the one that you want to focus on, and that it makes no sense to work on two branches at once.

When I said there is no D11 version of Matomo, I meant no usable version that allows a site maintainer to bring their site over to Drupal 11. If I recall correctly, the first tagged release of Matomo for D10 came some time after D10 was released, because the plan was that 2.x would be the Drupal 10 version. With Drupal 9 now unsupported, it's a good thing that we have a 1.x version that supports Drupal 10.

We're now over half-way through the period between the release of Drupal 11 and Drupal 12, and in just over a year's time Drupal 10 will drop off. Who knows how long the remaining work to get 2.x released will take, but as a maintainer of several sites I wouldn't want to have to rush a D10→D11 migration at the last minute.

I'm sure, once the 2.x branch has a stable release, there will be no need to keep the 1.x branch supported. I haven't looked at the main additional features coming in 2.x, but the only reason I'm using 1.x not 2.x is because I need a stable release to adopt.

Happy to help get version 2 stable. Is there a meta issue that outlines the roadmap and the remaining tasks?

c-logemann’s picture

Assigned: Unassigned » c-logemann

@jamesoakley I was not involved in the last steps to bring matomo module forward. So I only reviewed the logic of this issue and did not look into the code yet. I just found this issue (again): #3252606: [X.0.x] Roadmap.
After reading it I think it will take a little bit longer to get it stable. So getting D11 compatibility in version 1 is more important than I thought. I try to check and commit in the next days.

jamesoakley’s picture

Much appreciated, thank you.

jamesoakley’s picture

Related issues: +#3252606: [X.0.x] Roadmap
j-lee’s picture

After reading it I think it will take a little bit longer to get it stable. So getting D11 compatibility in version 1 is more important than I thought. I try to check and commit in the next days.

Great to hear this. Thank you.

sense-design’s picture

Thanks Carsten, we are also waiting with the Drupal upgrade because of Matomo.

c-logemann’s picture

Assigned: c-logemann » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

c-logemann’s picture

Thanks to everybody helping on this. Before creating next stable release I need to review last changes and maybe add some other bugfixes for problems especially for those blocking my manual tests today.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.