I have not set up Matomo before. You can try the following JavaScript code in the child theme’s JS file or use the “Simple Custom CSS and JS” plugin as shown in the screenshot below. This code will add the “cloud_login” CSS ID to every form on your website.
Thank you for reaching out and for providing this information. I also want to acknowledge and appreciate @faisalahammad efforts in assisting with troubleshooting on this issue.
Currently, Ninja Forms does not automatically add specific name or ID attributes to the form tag, which might be required by some analytics plugins like Matomo. However, you can customize your forms to include these attributes by adding a custom code snippet.
You can add a custom ID or name to your form by using Ninja Forms’ hooks and filters. Here is a basic example of how you can do this:
add_filter( 'ninja_forms_render_form_attrs', function( $attrs ) {
$attrs['id'] = 'cloud_login'; // Set your desired ID here
$attrs['name'] = 'cloud_login'; // Set your desired name here
return $attrs;
});
Please add this code to your theme’s functions.php file or a custom plugin. If you need detailed guidance on implementing this, or if there are other aspects of form customization you’d like to discuss, don’t hesitate to contact our Customer Success team.
One more point: I got several forms and it would be great to separate e.g. contact forms vs application forms by a specific name or ID. With the method above all forms got the same name or ID.
Maybe this could be implemented in future versions of Ninja Forms.