kslstn
May 24, 2022, 10:04am
#1
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.
kslstn
September 23, 2022, 1:37pm
#2
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
There is an enhancement that will be part of next version of Matomo:
opened 09:32AM - 06 Jul 21 UTC
closed 06:20AM - 18 Aug 22 UTC
Enhancement
Hi,
I use MTM and the goals feature.
When defining a goal, it is possible to… set a revenue... Also, following https://developer.matomo.org/api-reference/tracking-javascript it should be possible to track a goal with its revenue though javascript API:

But when I create a goal in the MTM, the value is not available:

1 Like
Hey with release of Matomo 4.12 support for goal amount will be added
matomo-org:4.x-dev
← matomo-org:334-add-goal-revenue-field
opened 01:31AM - 09 Aug 22 UTC
### Description:
Added a field input for the goal revenue when setting up a t… ag to manually trigger a goal. I also converted some hard coded strings to use the translation file.
Fixes: #334
### Review
* [ ] [Functional review done](https://developer.matomo.org/guides/pull-request-reviews#functional-review-done)
* [ ] [Potential edge cases thought about](https://developer.matomo.org/guides/pull-request-reviews#potential-edge-cases-thought-about) (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
* [ ] [Usability review done](https://developer.matomo.org/guides/pull-request-reviews#usability-review-done) (is anything maybe unclear or think about anything that would cause people to reach out to support)
* [ ] [Security review done](https://developer.matomo.org/guides/security-in-piwik#checklist)
* [ ] [Wording review done](https://developer.matomo.org/guides/pull-request-reviews#translations-wording-review-done)
* [ ] [Code review done](https://developer.matomo.org/guides/pull-request-reviews#code-review-done)
* [ ] [Tests were added if useful/possible](https://developer.matomo.org/guides/pull-request-reviews#tests-were-added-if-usefulpossible)
* [ ] [Reviewed for breaking changes](https://developer.matomo.org/guides/pull-request-reviews#reviewed-for-breaking-changes)
* [ ] [Developer changelog updated if needed](https://developer.matomo.org/guides/pull-request-reviews#developer-changelog-updated-if-needed)
* [ ] [Documentation added if needed](https://developer.matomo.org/guides/pull-request-reviews#documentation-added-if-needed)
* [ ] Existing documentation updated if needed
1 Like
kslstn
September 30, 2022, 7:08am
#5
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