Using Tag Manager to track goals with revenue

Before I added the Tag Manager, I tracked goals via my JavaScript like this:

const goalID = 1
const amount = 100;
_paq.push(['trackGoal', goalID, amount]);

Now that I I’ve replaced the Matomo snippet with MTM’s, I’m trying to replace this with something like:

window._mtm.push({'event' : 'conversion', 'goalID': goalID, 'conversionAmount': amount})

For this to work, I added to my MTM setup:

  • Two ‘Data-Layer’ variables in MTM: conversionAmount and conversionID
  • A trigger called ‘conversion’
  • A tag with ‘Goal’ as ‘Tracking Type’ and {{conversionID}} as the ‘Goal ID’.

So far, this seems to work in Preview mode! But how can I pass the conversion amount as the goal’s revenue to Matomo? The docs only seem to mention how to do that for generic events.

I just realized I can still use _paq.push(). Which accepts trackGoal, the ID and value.

Hi @kslstn,
I wanted to reply long time ago… But never finished my message :roll_eyes:
There is an enhancement that will be part of next version of Matomo:

1 Like

Hey with release of Matomo 4.12 support for goal amount will be added

1 Like

That’s awesome! Out of curiousity: other than having all triggers in one place in MTM and reducing confusion around this, would there be any benefits of using MTM for this instead of _paq.push()? I mean, should I update my tracking script to use MTM or will the end result and performance be the same either way?

Personally, when available in MTM, I prefer using the MTM version, but if absent, no choice: I use the _paq