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
- Create a new variable in Matomo Tag Manager
- Enter a name with a leading space, e.g.
myVariable
- Save the variable
- Create a trigger that references this variable
- 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

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
myVariableExpected 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