Reporting & Analytics

BIUser
Participant

Block automatic Hubspot tracking

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

0 Upvotes
2 Replies 2
BIUser
Participant

Block automatic Hubspot tracking

Hey Teun,

 

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

 

Added 

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:

<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

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Block automatic Hubspot tracking

Hi @BIUser ,

 

You can use this script to block HubSpot tracking as described in these docs:

_hsq.push(['doNotTrack']);

 

You can enable it again by using:

_hsq.push(['doNotTrack', {track: true}]);



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.