Disable form tracking for specific website

Our company has 2 websites for example
https://www.mycompany.com
https://app.mycompany.com

The first one is our main public facing website whcih we want to track visits and form submissions on. The second is our application, our main SaSS product and here we just want to use Hubspot for customer feedback surveys.
The problem we have, is we need to include the Hubspot tracking code on both sites, however our main app has many web forms in it and they are filling our Hubspot account up with loads of “non-hubspot forms” and it is messing with a lot of our workflows.
I have looked into the workarounds and making the forms non compliant with hubspot is not really an option for us. We have a lot of forms and it would be too much maintenance.
Another work around to disable form tracking at account level will not work, since we still want to collect forms for the public facing site.
I had also tried the following code I found in a forum, but it didn’t seem to work.

// When the script loads, disable tracking as we do not want all page visits and form submissions in the app to show in hubspot

                var \_hsq = (window.\_hsq = window.\_hsq \|\| \[]);

                \_hsq.push(\["doNotTrack"]);

                \_hsq.push(\[

                    "trackEvent",

                    {

                        id: "DisableFormTracking",

                        value: 0,

                    },

                ]);

So my question is, how can we have the Hubspot tracking code on https://app.mycompany.com but not track form submissions.

Hi, @michaelmoore :waving_hand: Welcome to our community!

For non-HubSpot forms, you can disable collection of these forms in-app from Settings. But it is not very granular, it’s either on or off. I haven’t tested any workarounds, but you could look at adding (or removing) one of the options mentioned under requirements – adding a hidden field should “break” the collection, for example.

Outside of this, there isn’t a more specific or programmatic way to stop this behaviour.

Best,

Jaycee

Thanks but unfortunately neither will work. We have too many forms to start adding aribitar fields to them all to make them non-hubspot compatible and it would add a lot of maintenance to development going forward. And we cannot use in in-app options because we need to have it one for one of our sites.

Hi, @michaelmoore

I encountered a similar challenge and attempted to override the JS settings without success. After some brainstorming, I came up with a solution that involves blocking POST requests to the HubSpot form URL. This approach worked for me. You’ll need to modify Axios to block all requests to forms.hscollectedforms.net. By implementing this, you won’t need to make any changes to your components, and it will minimize ongoing maintenance for future development.

Interesting, thanks for responding. I don’t suppose you’d be willing to share some sample code for that, i.e. I have to find where their library references Axios etc.