_mtm.push for Event Tracking

How to call EVENT Tracking for (Category, Action, Label, Name, Value) Using custom HTML : _mtm.push method
var _mtm = _mtm || []; and _mtm.push({ });

simillar to below method which working but not supporting properly in matomo

_paq.push([‘trackEvent’, category, action, name, value, {dimension1: ‘DimensionValue’}]);

        _mtm.push({
            'event': 'customEvent',
            'customCategory': category,
            'customAction': action,
            'customLabel': label,
            'customValue': value
        });

This below one is triggering and showing on debugger, when we run in console

$(’.columns.medium-4.storyItem’).click(function(){
var label =$(this).find(’.storyTitle’).text();
if (label != “”){
alert(label);
window._paq = window._paq || [];
window._paq.push([‘trackEvent’, ‘In page555’, ‘click555’, label]);
}
})


This below one is not triggering and showing on debugger

$(’.columns.medium-4.storyItem’).click(function(){
var label =$(this).find(’.storyTitle’).text();
if (label != “”){
alert(label);
window._mtm = window._mtm || [];
window._mtm.push({
‘event’: ‘customEvent’,
‘customCategory’: ‘In paGe’,
‘customAction’: ‘ClicK’,
‘customLabel’: label
});
}
})

URL : https://www.grunenthalhealth.de/de-de/medizinisches-fachpersonal/neuigkeiten-und-artikel/

In my example, you have to have previously defined:

  • customEvent trigger
  • customCategory variable
  • customAction variable
  • customLabel variable
  • And a tag triggered on customEvent trigger…

$(‘.columns.medium-4.storyItem’).click(function(){
var label =$(this).find(‘.storyTitle’).text();
var category = ‘InpaGeee’;
var action = ‘InpaGeee’;
var value = ‘tttEST’;

if (label != ""){
   alert(label);
   window._mtm = window._mtm || [];
   window._mtm.push({
        'event': 'customEvent',
        'customCategory': category,
        'customAction': action,
        'customLabel': label,
        'customValue': value
    });
}

})

still not working

→ In the Matomo Tag Manager !