Problem/Motivation

Only integer values are allowed for Site ID.
I need to integrate Matomo with a particular account. The account contains a site ID with alphanumeric values.
See, for example, the ProtectTrackID plugin.

Steps to reproduce

Matomo Drupal module allows only integer values for Site ID. The Matomo form settings contains a validation for Site ID field.

Proposed resolution

I created a patch to solve the problem. The patch adds a field to bypass Matomo settings validation. This field allow to skip the validation for the site ID field.

Issue fork matomo-3188589

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

marco.aresu created an issue. See original summary.

marco.aresu’s picture

grimreaper’s picture

Status: Active » Needs work
Issue tags: -validation

Hello,

In this case, I am more in favor of removing the site ID validation rather than introducing a new setting to bypass it.

pfrenssen’s picture

How can a site ID be anything but an integer? Are you using a modified Matomo instance? According to the Matomo API the site ID is always an integer. Ref. https://developer.matomo.org/api-reference/Piwik/Site#getid and https://developer.matomo.org/api-reference/reporting-api#standard-api-pa...

pfrenssen’s picture

In the Matomo database model the site ID is defined as an unsigned integer, ref. https://github.com/matomo-org/matomo/blob/4.x-dev/core/Db/Schema/Mysql.p... - and this has been unchanged since the days when it was still called Piwik, ref. https://gitlab.com/piwik/piwik/-/blob/master/core/Db/Schema/Mysql.php#L75

If you are using a hacked Matomo / Piwik instance which has a modified database scheme, then I would suggest that you implement a hook_form_alter() to match your customized instance.

grimreaper’s picture

Status: Needs work » Closed (works as designed)

Thanks @pfrenssen for the investigations!

Closing.

@marco.aresu, feel free to reopen if you can explain how you have a site ID with other characters than integers.

davide.porrovecchio’s picture

Issue summary: View changes
Status: Closed (works as designed) » Active

Hello,
if a Matomo instance is using the ProtectTrackID plugin the idsite parameter can be a generic string.
I think this is a valid use case to consider for this issue.

marco.aresu’s picture

The Agid Web Analytics Italia use Matomo. The italian agency generate a site ID with alphanumeric values.

grimreaper’s picture

Version: 8.x-1.11 » 8.x-1.x-dev
Status: Active » Needs review

Thanks @davide.porrovecchio for pointing to the Matomo community module.

Now I understand the need.

Please review the created MR.

@pfrenssen: will this have an impact in the Matomo ecosystem modules you maintain?

  • Grimreaper committed 97b2380 on 8.x-1.x
    Issue #3188589 by marco.aresu, Grimreaper, pfrenssen, davide....
grimreaper’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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