matomo-org / matomo-java-tracker

Official Java implementation of the Matomo Tracking HTTP API.
https://matomo-org.github.io/matomo-java-tracker/
BSD 3-Clause "New" or "Revised" License
69 stars 52 forks source link

Enforce limit of five custom variables with at most 100 characters per Matomo request #164

Closed dheid closed 12 months ago

dheid commented 12 months ago

Presently, the Matomo Java Tracker library does not enforce the Matomo instance's limitation of five custom variables per request and 100 characters per key and value field. To align with Matomo's specifications, we need to implement a check within the library to ensure that no more than five custom variables and 100 characters are added in a single request.

Expected Behavior: Upon attempting to add a sixth custom variable in a single request, the system should throw a MatomoException to indicate that the Matomo instance only supports up to five custom variables and 100 characters per request.

Steps to Reproduce:

  1. Add five custom variables using the Matomo Java Tracker library in a single request.
  2. Attempt to add another custom variable within the same request.
  3. Add a custom variable with a key that is longer than 100 characters.

Actual Result: The library allows the addition of the sixth custom variable without adhering to Matomo's restriction, potentially causing discrepancies.

Expected Result: The system should throw a MatomoException when attempting to add a custom variable beyond the Matomo instance's limit of five per request.

Additional Information:

Note: By implementing this check, we aim to ensure that the Matomo Java Tracker library aligns with Matomo's specifications, preventing unintended behavior and maintaining compatibility with Matomo instances enforcing the custom variables limit.

dheid commented 12 months ago

This limitation existed in earlier versions but no longer