Prevent Cookie tracking of a specific form

SOLVE
FF2
Participant

Hello,

 

I am using Hubspot on my site http://www.7Plusclub.de, which is running on wordpress.

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”>?

0 Upvotes
1 Accepted solution

Accepted Solutions
AdityaBansal
Solution
Member | Platinum Partner

Hi @FF2

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.

  1. I noticed that when you specify in HubSpot to collect info from non-HubSpot forms, it attempts to add the script collectedforms.js to your website. However, before doing so, it checks to see if it's already installed by using the document.getElementById method where the ID is CollectedForms-1234 (1234 is 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.

  2. What you need to do is add the following code to it:

    <label for="amex" style="display:none">AMEX</label>
    <input type="hidden" name="amex" required="" value="" id="amex">

    HS JS tracking code will deem your form as one that contains sensitive data and will ignore it. 

View solution in original post

3 Replies 3
AdityaBansal
Solution
Member | Platinum Partner

Hi @FF2

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.

  1. I noticed that when you specify in HubSpot to collect info from non-HubSpot forms, it attempts to add the script collectedforms.js to your website. However, before doing so, it checks to see if it's already installed by using the document.getElementById method where the ID is CollectedForms-1234 (1234 is 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.

  2. What you need to do is add the following code to it:

    <label for="amex" style="display:none">AMEX</label>
    <input type="hidden" name="amex" required="" value="" id="amex">

    HS JS tracking code will deem your form as one that contains sensitive data and will ignore it. 

View solution in original post

FF2
Participant

1. Works like a charm - THANK YOU!!!!

0 Upvotes
AdityaBansal
Member | Platinum Partner

I'm glad I could help @FF2

 

Could you please mark my answer as solution to help others as well?

0 Upvotes