Skip to content

Sulu 3.0 Matomo URLs are not correct #7732

@benr77

Description

@benr77
Q A
Sulu Version 3.0
PHP Version 8.4

Actual Behavior

The Matomo analytics feature has been updated to refer to matomo.js instead of the legacy piwik.js.

However, something appears to have changed regarding the trailing slash on the URL, and or the concatenation of the URL with the JS file.

Expected Behavior

We get a URL formatted as https://my-matomo-instance.com/matomo.js.

Steps to Reproduce

In the admin, set https://my-matomo-instance.com/ (with a trailing slash).

In the front-end HTML, you get var u="https://my-matomo-instance.com"; which has no trailing slash, which is then concatenated a couple of lines later using g.src=u+'matomo.js'; which results in https://my-matomo-instance.commatomo.js which is not correct and has a missing / character.

Secondly, there is a fallback <img> element, which gets a URL with a double forward slash e.g. https://my-matomo-instance.com//matomo.js which is also incorrect.

Solution

Canonicalise the URL with a trailing slash when saving to the database, and then correct the template file to not add additional slashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError or unexpected behavior of already existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions