Hi there,
I’m a new user of Matomo. It seems that the configuration of click tracking is done in 3 steps:
create de trigger, that matches when id = btn-id ;
create a tag that is linked to the trigger ;
add a Js code onclick=“_paq.push(…)”, with tag parameters.
In my case, everything seems to be configured as desired, but no event is tracked when I clicked on the button. How to debug my configuration, to detect what is wrong? I’ve seen some docs, video, examples, but nothing helped me.
Other thing: Doing these 3 steps are tedious to track a single click “button ‘Hello’ clicked”.
OK. Its also an a(nchor) HTML element and not a button. The a element has not a value="", that is needed by {{ClickButton}}. The value="" must be a number: 9 or 1.23.
_paq.push([‘trackEvent’, ‘Prestations’, ‘Massages’, ‘Tarifs’]
Category: (string) Prestations
Action: (string) Massages
Name: (string) Tarifs
Value: (number) [autmatically added if a value exist]
difficult to find an error.
Maybe the quotes are not correct. You use ‘ and correct is '.
You can add a value manually: _paq.push(['trackEvent', 'Prestations', 'Massages', 'Tarifs', myvalue]
Is the matomo tracking code embeeded and is the matomo.js loaded?
Use the browser inspector console to check errors.
Hello (I replied to the email, but I don’t see my reply in the forum).
Thanks for your answer.
I’ve changed the “a” tag by a “button” tag, with a value “1”. So the code becomes
button class=“btn btn-primary” data-bs-toggle=“modal”
data-bs-target=“#massagesModal” id=“btn-modal-massages” value=“1”
onclick=“_paq.push([‘trackEvent’, ‘Prestations’, ‘Massages’, ‘Tarifs’, 1]);”
I also checked that the embedded js code (calling the “container_NUV5Cei9.js” file) is loaded as required by the doc “as high as possible into the “head” part of the page”. The matomo.js is called at the end (I also tried to put it at first).
There is no JS error in the page, or when I clicked the button.
The click does nothing in Behavior / Events tracking.
I’ve activated the debug mode, but I don’t understand the result:
You seem to be mixing manual _paq.push commands AND the tag manager.
Use EITHER OR, not both.
If you’re having problem with the tag manager a tip is to make a generic click event that triggers on all clicks (you can do a custom HTML tag with a small javascript that outputs “testing” in the console) and then do the preview mode and then check the variables. Matomo tag manager is a little pain in the a** to debug and the variables doesn’t always reflect what you thought they would.