# Block automatic Hubspot tracking

**URL:** <https://community.hubspot.com/t/block-automatic-hubspot-tracking/61635>\
**Category:** Reporting & Analytics\
**Tags:** enterprise\
**Created:** [July 25, 2022, 12:34pm UTC](https://community.hubspot.com/t/block-automatic-hubspot-tracking/61635 "2022-07-25T12:34:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BIUser](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/biuser/32/5125_2.png) [@BIUser](https://community.hubspot.com/u/BIUser)\
**Post date:** [July 25, 2022, 12:34pm UTC](https://community.hubspot.com/t/block-automatic-hubspot-tracking/61635/1 "2022-07-25T12:34:37Z")

</div>

Hi all,

we are facing the following problem with Hubspot.

Setup:

- We have various domains. Some of them are pure Hubspot pages. Some of them are pure selfmade. Some of them are a mix of selfmade and Hubspot pages.

- We use the Google Tag Manager to trigger our trackings

- Within GTM also our Consent Tool is injected into the page

- This consent tool is used to have a global consent management for our various domains

- We don’t use Hubspots consent management for the above reason

- Hubspot tracking pixel is triggered via GTM

Problem:

- Hubspot is automatically tracking it’s pages

Goal:

- Stop Hubspot from automatic tracking of pages as we trigger the tag via GTM

Do you have any idea about how this can be done?

Cheers

Torben

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [July 25, 2022, 6:23pm UTC](https://community.hubspot.com/t/block-automatic-hubspot-tracking/61635/2 "2022-07-25T18:23:50Z")

</div>

Hi @BIUser ,

You can use this script to block HubSpot tracking as described in these [docs](https://developers.hubspot.com/docs/api/events/cookie-banner):

\_hsq.push([‘doNotTrack’]);

You can enable it again by using:

\_hsq.push([‘doNotTrack’, {track: true}]);

---

<div class="post-metadata">

**Author:** ![BIUser](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/biuser/32/5125_2.png) [@BIUser](https://community.hubspot.com/u/BIUser)\
**Post date:** [August 11, 2022, 7:05am UTC](https://community.hubspot.com/t/block-automatic-hubspot-tracking/61635/3 "2022-08-11T07:05:07Z")

</div>

Hey Teun,

thank you for your input. Right now this seems not to fix our general problem. This is what we did:

Added

```lia-code-sample
var _hsq = (window._hsq = window._hsq || []);
var _hsp = (window._hsp = window._hsp || []);
_hsq.push(["doNotTrack"]);
_hsp.push(["doNotTrack"]);

```

to our page configuration to block the automatic tracking.

In our GTM Hubspot tracking tag we added:

```lia-code-sample
<script>
 var _hsq = window._hsq = window._hsq || [];
 _hsp.push(["doNotTrack", { track: true }]);
 _hsq.push(["doNotTrack", { track: true }]);

 _hsq.push(['setPath', window.location.pathname]);
 _hsq.push(['trackPageView']);
</script>

```

This results in a blocking of the automatic tracking and the triggering of the GTM tag.

But as soon as we click on a form field the automatic Hubspot tracking triggers a page view.

Cheers

Torben
