I found out, that using the hubspot option “Collect data from website forms”, which can be found in the “Non Hubspot Forms” menu works perfectly fine for me to track any <form> submissions on my website.
However, I have one form, in which my users do not type their own email address, but an email address of another member in order to contact him. As soon as this form is submitted, the data transferred to hubspot is a complete mess, because the cookie is interpreted with a wrong email address.
Is there any hack / tag / exclude I can use, to prevent tracking of this single specific form on my website? E.G. a class name like <form class=”doNotTrack”>?
I've found 2 possible solutions to your problem. Since you are looking to prevent tracking from single specific form, you can try either of the following ways.
I noticed that when you specify in HubSpot to collect info from non-HubSpotforms, it attempts to add the script collectedforms.jsto your website. However, before doing so, it checks to see if it's already installed by using the document.getElementByIdmethod where the ID is CollectedForms-1234 (1234is the ID at the end of your tracking script). Therefore, if you simply put any HTML element on your page with that ID, such as <span id="CollectedForms-1234"></span>, it won't install the collectedforms.js file, meaning it also won't collect information on your non-HubSpot forms. While still a hack, it doesn't force you to change your forms, and it's much easier to conditionally add it based on where the user is in your app. Just be sure that this element exists statically on your website, and isn't loaded dynamically.
What you need to do is add the following code to it:
I've found 2 possible solutions to your problem. Since you are looking to prevent tracking from single specific form, you can try either of the following ways.
I noticed that when you specify in HubSpot to collect info from non-HubSpotforms, it attempts to add the script collectedforms.jsto your website. However, before doing so, it checks to see if it's already installed by using the document.getElementByIdmethod where the ID is CollectedForms-1234 (1234is the ID at the end of your tracking script). Therefore, if you simply put any HTML element on your page with that ID, such as <span id="CollectedForms-1234"></span>, it won't install the collectedforms.js file, meaning it also won't collect information on your non-HubSpot forms. While still a hack, it doesn't force you to change your forms, and it's much easier to conditionally add it based on where the user is in your app. Just be sure that this element exists statically on your website, and isn't loaded dynamically.
What you need to do is add the following code to it: