Contact Form 7 + Hubspot, adding a Javascript event to Submit button stops data being sent to Hubspot


Hi guys,
So we are using Contact Form 7 for our form. We have set it up with the Hubspot plugin for Wordpress and it sends the contact data to Hubspot no problem.

The problem lies when we want to bind some Javascript to the submit button so it re-directs to another page/file. This stops the contact data from being sent to Hubspot.

I know everywhere in the docs it says the following:
"Form has JavaScript bound to form submit event or submit button click event. This is how the tool captures submissions and any other events can prevent HubSpot from knowing when submissions occur"

So what can we do to get around this?

Im using this basic code to do the re-direct as recommended by Contact Form 7

<script> document.addEventListener( 'wpcf7mailsent', function( event ) { location = '/wp-content/uploads/2018/09/diploma.pdf'; }, false ); </script>


Hi @Tom_Byrom,

As the documentation outlines, custom event listeners prevent the collected forms tool from picking up submission events. At this time, I don't know of any ways to get around this.

Depending on your subscription level, alternatives to redirecting a Contact Form 7 form to a file include:


This topic was automatically closed after 7 days. New replies are no longer allowed.