Ignore a specific non-Hubspot form from being collectedSOLVE
Jan 22, 2019 8:09 AM
Is there an option to keep the "Collect data from website forms" option enabled, but to somehow mark a few forms to be skipped by the Hubspot form tracking JS code?
I vaguely recall there was some markup feature, but, for the life of me, I can't find any evidence to that.
Solved! Go to Solution.
Jan 30, 2019 5:42 AM
Well, while we're at it and I don't have a blog to post it to, there is a way to exclude a specific form from being collected.
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.
Oct 29, 2019 6:45 AM
I've gone and looked at the source for collected-forms.js
They check for the following labels:
, s = ["credit card", "card number", "expiration", "expiry", "ccv", "cvc", "cvv", "secure code", "mastercard", "american express", "amex"]
and the following for names:
, c = ["cc-num", "cc-number"]
in a function called isSensitive which is used in a function called rejectIfAnyFieldSensitive
So I've managed to get the form to not submit with the following markup:
<label for="cc-num" class="hidden">credit card HubspotCollectedFormsWorkaround https://community.hubspot.com/t5/APIs-Integrations/How-to-stop-collected-forms-from-collecting-a-form/m-p/299172#M28102</label> <input name="cc-num" class="hidden" required="" value="HubspotCollectedFormsWorkaround" id="cc-num">
Would be great if this could be added to the documentation
Sep 6, 2020 7:59 PM
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