Non-HubSpot forms are not captured when they are submitted via Ajax.

THirose
Participant | Partner

Hello,

 

Our drupal website has a non-Hubspot form that sends form data with Ajax. Other non-HubSpot forms without Ajax are captured successfully by the HubSpot tracking code but the Ajax one is not. Is there any way to have the HubSpot code detect/capture the AJAX form submission and send the form data to our Hubspot account? Our intention here is not to write custom codes to send form data with Ajax using a POST request, rather to have all the non-HubSpot forms, including ajax and non-ajax ones, auto-captured upon submission by the HubSpot code.

 

Our website system environment:

  • HubSpot tracking code is integrated into the website with a google tag manager (by drupal GTM module).
  • HubSpot cookie compliance banner is enabled on the website.
  • Powered on Drupal 8. The ajax form is built with drupal webform module with an Ajax option enabled. If I disable the ajax, it works. But when I enable it again, doesn't work.

I looked at this knowledge-base page (https://knowledge.hubspot.com/forms/use-non-hubspot-forms) and tried everything I can, but still cannot get it working.

 

Thank you

0 Upvotes
2 Replies 2
himanshurauthan
Key Advisor | Platinum Partner

Hi @THirose,

 

As mentioned here, in your case, point 3 and point 8 seem to be closely related and if that's the case then they won't be tracked without using the custom JS. 

 

image_2021_02_18T08_05_24_860Z.png

 

 

I guess this might help you.

 

Best Regards,

Digital Marketing & Inbound Expert In Growth Hacking Technology
THirose
Participant | Partner

Thank you for your reply, Himanshu!

 

I tried point 8 but still not working. I am thinking that Ajax in this case is what the point 3 is saying.

 

I'd like to know what the custom JS would be to have the HubSpot JavaScript code detect and capture an ajax non-HubSpot form submission. 

 

Regards,

Takaya