# Hubspot and OneTrust cookie interaction

**URL:** <https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [August 10, 2020, 5:55pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008 "2020-08-10T17:55:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jerry13/32/44503_2.png) [@jerry13](https://community.hubspot.com/u/jerry13)\
**Post date:** [August 10, 2020, 5:55pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/1 "2020-08-10T17:55:27Z")

</div>

Looking to implement OneTrust cookie banner solution on our Hubspot hosted site. These are some of the things that I am looking to get some answers to:

1) Is there a way to add Hubspot tracking cookies to Google Tag Manager

2) How to disable the Hubspot cookie banner without disabling the cookies themselves

3)Is there a way to enable/disable Hubspot’s cookies in a javascript function instead of interacting through the Hubspot cookie banner

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 12, 2020, 4:50pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/2 "2020-08-12T16:50:37Z")

</div>

hello @jerry13 !

Here are some resources for you

1. [Install HubSpot tracking code via Google Tag Manager](https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code)

You will need to scroll way down to bottom of page for GTM section

2. You can control the banner in the portal settings -- cookies. [Here](https://knowledge.hubspot.com/reports/customize-your-cookie-tracking-settings-and-privacy-policy-alert) is a link reviewing the cookies

3. [Here](https://legacydocs.hubspot.com/docs/methods/tracking_code_api/remove_cookies) is an example of removing cookies via a js function

Here’s hoping this leads you in the correct direction!

---

<div class="post-metadata">

**Author:** ![jerry13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jerry13/32/44503_2.png) [@jerry13](https://community.hubspot.com/u/jerry13)\
**Post date:** [August 12, 2020, 8:15pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/3 "2020-08-12T20:15:10Z")

</div>

Hi, thanks for the link to how to setup the tracking code in GTM. The banner also is disabled now via the portal. The only thing that is not working is removing the Hubspot cookies from the site. I tried including the javascript in the link you sent in the template of my page, but I’m not sure what is being blocked. I still see a bunch of cookies being set from app.hubspot.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 12, 2020, 8:45pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/4 "2020-08-12T20:45:03Z")

</div>

Hey @jerry13 ,

Glad we are two-thirds there. 🙂

Could you provide a link to where you have added that code?

Did you copy the code exactly, if so, does your button have the id

removeCookies

---

<div class="post-metadata">

**Author:** ![jerry13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jerry13/32/44503_2.png) [@jerry13](https://community.hubspot.com/u/jerry13)\
**Post date:** [August 13, 2020, 4:00pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/5 "2020-08-13T16:00:30Z")

</div>

Hi @dennisedson ,

This is the test site that I am working on [https://services.test.businesswire.com/](https://services.test.businesswire.com/) .

I put it in the head tag of the page in a script on line 35. Also I removed the function call as I just want it to do it on every page load. What I am going for is basically disabling the Hubspot innate banner and cookies and put those in Google Tag Manager instead.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 13, 2020, 8:50pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/6 "2020-08-13T20:50:51Z")

</div>

Hey @jerry13 ,

I think the next option is [this.](https://legacydocs.hubspot.com/docs/methods/tracking_code_api/place_do_not_track_cookie)

You will need to update that code example to fire without needing a button click, but that _should_ work.

Please test (obviously) and let us know if that worked for you

Best of luck!

---

<div class="post-metadata">

**Author:** ![jerry13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jerry13/32/44503_2.png) [@jerry13](https://community.hubspot.com/u/jerry13)\
**Post date:** [August 14, 2020, 7:46pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/7 "2020-08-14T19:46:14Z")

</div>

@dennisedson

I included both those calls in the script already without an onclick function so it should just fire whenever page loads, but they are currently still not disabling the Hubspot cookies.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 17, 2020, 3:15pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/8 "2020-08-17T15:15:07Z")

</div>

hey @jerry13 !

Was looking at your site and it looks like you use a

p

instead of a

q

in the code. It should be:`_hsq.push(['doNotTrack'])`

I tested in the console and it set the

hs\_do\_not\_track

cookie to yes

---

<div class="post-metadata">

**Author:** ![jerry13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jerry13/32/44503_2.png) [@jerry13](https://community.hubspot.com/u/jerry13)\
**Post date:** [August 17, 2020, 5:00pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/9 "2020-08-17T17:00:04Z")

</div>

Hi @dennisedson ,

I changed it back to “hsq” but I still see hubspot cookies being set in my browser.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 18, 2020, 6:49pm UTC](https://community.hubspot.com/t/hubspot-and-onetrust-cookie-interaction/24008/10 "2020-08-18T18:49:49Z")

</div>

hey @jerry13 , apologies for delayed response.

I think it may be firing too quickly. Can you write it like this

```lia-code-sample
$(window).load(function(){
	var _hsp = window._hsp = window._hsp || [];
 	_hsp.push(['revokeCookieConsent']);
 	_hsq.push(['doNotTrack']);
})

```

Thanks!
