Add Tracking Events on different forms for GTA

I need help how to add different Tracking events to different hubspot forms, these are forms used on pages using forms module and are not embedded forms

For embedded I can use this code
{% require_js %}
<script>
hbspt.forms.create({
portalId: ‘your_portal_id’,
formId: ‘{{ module.form_field.form_id }}’,
onFormSubmit: function($form) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push [{
‘eventName’: ‘trackingEvent’,
‘eventCategory’: ‘forms’,
‘eventAction’: ‘submit’,
‘eventLabel’: ‘pricing’
}];
}
});
</script>
{% end_require_js %}

But for the module forms where do I add different events, as the code goes like this
{% form
form_to_use=“{{ module.form_field_1.form_id }}”
response_response_type=“{{ module.form_field_1.response_type }}”
response_message=“{{ module.form_field_1.message }}”
response_redirect_id=“{{ module.form_field_1.redirect_id }}”
response_redirect_url=“{{module.form_field_1.redirect_url}}”
gotowebinar_webinar_key=“{{ module.form_field_1.gotowebinar_webinar_key }}”
%}

Any help on this would be highly appreciated, it a urgent task

Thankyou

@dbeau79 , @Gonzalo , would either of you be able to assist @AYadav ?

@AYadav , I’ve only done this using the embed code but I believe you could do this using a global form event like this:

window.addEventListener('message', event => {
 if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push [{
'eventName': 'trackingEvent',
'eventCategory': 'forms',
'eventAction': 'submit',
'eventLabel': 'pricing'
 }
});

Documentation: Accounts Dashboard | HubSpot