How to get data from event in tag?


what is the right way to get data from an event in a trigger?

I tested a few things:

When I push an event like _mtm.push({event: ‘purchase’, orderTotal: 4545.45, otherKey: ‘otherValue’}); then I have the orderTotal in dataLayer at dataLayer.values.orderTotal. I can pass any data I want to dataLayer in this way.

But how can I access the event data in a tag?

Do I have to create a new variable in Tag Manager for each “key” from the event-object to to get this value via {{orderTotal}}?

Or is there a more “direct” way to get the event-data in the tag?

Thanks for some help with this!

Best regards,


If you use the e-commerce plug-in, you can have a look there: Product purchase tracking with Tag Manager - Tag Manager - Matomo forums

If not, you can:

  • either use the datalayer variable in your event (defined in the tag manager e.g. Event Name = {{otherKey}} Event Value = {{orderTotal}})
  • or use the action custom dimensions (Administration cog > Measurables > Custom Dimensions). In such scenario, don’t forget to update the Matomo configuration variable in the MTM to take the custom dimensions into account.


thanks for your reply!

But to use Event Name = {{otherKey}} I have to create a new dataLayer variable in tag manager so the otherKey from the event is passed to the dataLayer variable, right?

So it’s not a good way to add additional data to an event which is not defined as dataLayer variable in tag manager?

Hope you understand my thoughts.

Best regards,


As you push _mtm.push({event: ‘purchase’, orderTotal: 4545.45, otherKey: ‘otherValue’});, I assume orderTotal and otherKey are already in the datalayer, or maybe there is something I missed?

Thanks for your reply.

That is part of my question: Do I have to create a new dataLayer-variable in Tag Manager for each “key” from the event-object?

In my understanding: If I don’t create a dataLayer-variable in Tag Manager the event-data is available in dataLayer.values.otherKey but not in {{ otherKey }}. To get the value in {{ otherKey }} it is necessary to create a variable otherKey as dataLayer-variable in Tag Manager.

Is this right?

Yes, this is also my understanding of MTM datalayer… :wink: