Following Contact Form 7 successfull submissions in Matomo

Hi. I’m looking for community help :slight_smile:

I want to add to GTM code for tracking in Matomo successful Contact Form 7 form submission. In task I have following preresiquites:

  • I must use GTM, not Matomo Tag Manager (we don’t want to attach second tag manager to our website)
  • No additional plugins if possible
    *No adding JS code to HTML (It would make things simple, but I want to avoid it as well).

I created in GTM such event listener

  if (window.location.toString().indexOf("/contact/") != -1) {    document.addEventListener( 'wpcf7mailsent', function( event ) {      window.dataLayer.push({
      "event" : "cf7submission",
      "formId" : event.detail.contactFormId
     })
    });
  };

and used it to create tag and triggers. But when I’m trying to create Matomo tag I encounter some problems.
a) I don’t know if tag’s construction would be similar to the one that I did for GA4 and GAU? (I used this tutorial to create those tags: https://www.analyticsmania.com/post/contact-form-7-event-tracking-with-google-tag-manager/)
b) I have problems with Matomo syntax - I’m going through documentation and trying to find out, how to create tag based on the class that appears when sending form is successful).

As far as I see Matomo Cloud dashboard notes submitting form, but I’m not sure whether these are only successful submissions or all submissions.

Any help would be appreciated.