Hi Jasper,
Thanks for sending through the examples for us to test this via email.
Generally it would work using the trackForm call above for an element inside the shadowRoot if you pass the form element inside the shadowRoot as a parameter.
However, inside the shadowroot you don’t seem to have a element with input fields.
There is a form element but it only has a button.
Instead you use a slot element which lets you create separate DOM trees and present them together as if it was one. Every form element is again in it’s own shadowRoot etc.
Unfortunately we can’t think of any workaround so far and we can’t hard code anything for your specific HTML markup naming. If you weren’t using the SLOT feature then it would work out of the box if you were passing eg
_paq.push(['FormAnalytics::trackForm', document.querySelector('[form-id=matomo-form]').shadowRoot.querySelector('form')])
I trust this information will be useful in getting this working.
Thanks