My organization requires us to use a 3rd Party Cookie Management Tool (OneTrust).
As a result, I’m looking to understand what is the best way to enable and disable the analytics tracking script via the OneTrust cookie banner.
After consulting this article (Consent banner API - HubSpot docs), our approach is to place the Do Not Track cookie by default via Google Tag Manager and then enable tracking via a GTM script that sets “_hsq.push([‘doNotTrack’, {track: true}]);” and then disable via a script that sets “_hsq.push([‘doNotTrack’, {track: false}]);”
Does this seem like an appropriate approach? Is there a better way?
It is indeed the best way : add the do not track cookie by default and then remove it when the user approves the tracking through the One Trust banner.
Especially if you’re on HubSpot CMS since you cannot remove the tracking script which is added to your pages by default.
Hope this helps !
If it does, please consider marking this answer as a solution