Skip to content

Variable name validation should reject leading/trailing whitespace #1083

Description

@mindbreaker

When creating a variable in Matomo Tag Manager, it is currently possible to include a leading space in the variable name. This causes issues when the variable is later referenced in trigger conditions, as the name matching fails silently due to the whitespace mismatch.

Steps to reproduce

  1. Create a new variable in Matomo Tag Manager
  2. Enter a name with a leading space, e.g. myVariable
  3. Save the variable
  4. Create a trigger that references this variable
  5. The trigger condition does not work as expected because the variable name includes the hidden leading space

Expected behavior

The variable name input should be validated to trim or reject leading and trailing whitespace characters. This validation should ideally apply on save, similar to how other naming constraints are enforced.

Actual behavior

The variable is saved with the leading space included in the name. When referencing the variable in triggers, the whitespace causes a mismatch that is difficult to debug since the space is not visible in the UI.

Suggested fix

Add whitespace trimming or a validation error to the variable name field. This could be handled either by automatically trimming whitespace on save or by showing a validation message that informs the user about invalid characters.

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingtriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions