Tag Manager Custom Event Trigger Not Working in Matomo 5.1.2

Hey Matomo folks,

I’m stuck with a custom event trigger in Matomo Tag Manager (5.1.2, self-hosted) that’s not firing right for form submits on my WordPress site. It works in debug mode, but in production, it misses about a third of the submissions.

Setup: Running Matomo 5.1.2 on Ubuntu 22.04 with PHP 8.2 and MySQL 8.0, tied to WordPress 6.7.1. I set up a trigger for a form_submit dataLayer event, but logs say “Trigger condition not met” even though the dataLayer push shows up in Chrome’s console.

What I Tried: Cleared caches, republished the container, tested in Edge, and checked dataLayer timing. No JS errors. I saw a 2024 thread about a similar issue, but no fix there.

Question: Has anyone got custom event triggers working smoothly in 5.1.2? Any settings I might’ve missed or debug tricks to try? Appreciate any pointers!

Hey @Alsi4576, I had a similar issue with Matomo Tag Manager 5.1.2 on WordPress.

The “Trigger condition not met” error often means the dataLayer push is too late for the trigger. Try this:

  1. In Tag Manager, edit your form_submit trigger and add a 100ms delay (under Advanced Settings > Trigger Delay).
  2. Ensure your form’s JS pushes to window._mtm before the submit event (e.g., window._mtm.push({'event': 'form_submit'});).
  3. Check if WordPress plugins (e.g., caching) minify JS, which can break dataLayer. Exclude Matomo’s container JS in your caching plugin settings.

Test in Preview/Debug mode again, then republish. This fixed my form tracking misses. Hope it helps!

Thanks for the detailed fix! I’ll try the 100ms delay, check my JS push, and exclude Matomo’s JS from caching. Will test in Debug mode and report back. Appreciate it! :blush: