Reference a variable inside a variable

Hi there,
I wanted to find out if it is possible to have a custom JS variable that references a dataLayer variable? The idea is to take the dL variable and change its output values with custom JS.
We’ve had some issues with variables referencing other custom variables inside them before which is why I have decided to ask the Matomo Community for insights and advice.
Any info is much appreciated.
Cheers
Julia

Hi Julia,

Could you clarify what you’re trying to achieve? What have you tried and what happened VS what you expected? Have you tried changing the data layer variable directly as explained in Data Layer: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3