CMS Development

WBottlick
Member

Not sure how to disable third party cookie initiators being loaded in standard_header_includes

SOLVE
We currently have are trying to remediate an issue where we have several third party tracking cookies that are not being being disabled when a user opts out of cookies with our banner. I fully understand that this is because the default HubSpot cookie banner does not automatically target third party cookies, and that I need to be able to add some wrapping logic around the cookie initiators that listens for the cookie opt in signals.

The problem is that while I can see the scripts that are initiating the tracking cookies that I need to disable, after combing through all the HubSpot settings I can think of, I have no idea how to access whatever setting is loading these scripts into our <head> section across all our pages.

As an example, after looking at the source HTML+HubL for our homepage template, I can see that there is a HubL variable called {{ standard_header_includes }}. The only thing I can think of is that this variable is loading these scripts in, but I have no idea where. After looking through documentation and forum posts, it also looks like this variable in general cannot be edited by users, only added to in other settings fields.

I need some help locating how to access and edit the full extent of the <head> section that loads across our site. I already know it is not the Pages > Templates > Site Header HTML section in Settings. We do already have several tracking scripts being told to listen to the cookie banner there that we were manually loading, but I still have more that are not being loaded there, including the example script I listed above. It seems like there are a ton more scripts, styles, and meta objects being loaded into the <head> that I just have no idea where they are coming from or being set by.
 

 

0 Upvotes
1 Accepted solution
frameofwork
Solution
Participant

Not sure how to disable third party cookie initiators being loaded in standard_header_includes

SOLVE

Hi @WBottlick  , 

 

Which scripts are you specifically looking to remove/affect?

 

Because standard_header_includes is a variable, you can use filters to affect this variable (at your own risk since this default variable brings in a lot of HubSpot scripts needed to power specific functionality). One such filter that can help you here is the replace filter which I've linked.

 

Something like the following should work:

{{ standard_header_includes|replace('<script>fetch the script here</script>', '')}} 

 

Some other ways people have found helpful in manipulating this variable are highlighted in the post here: https://community.hubspot.com/t5/CMS-Development/How-to-use-standard-header-includes-without-loading...

 

I generally like to pprint out specific variables to see what's inside and try to filter down what I want from there. If you can share specific scripts/stylesheets that you're unsure about, I can see if there is more context I can provide based on my experience.

 

For now, the above should allow you to manipulate this variable as you need although be warned that improperly setting this up could impact things like analytics from HubSpot's end.

View solution in original post

2 Replies 2
frameofwork
Solution
Participant

Not sure how to disable third party cookie initiators being loaded in standard_header_includes

SOLVE

Hi @WBottlick  , 

 

Which scripts are you specifically looking to remove/affect?

 

Because standard_header_includes is a variable, you can use filters to affect this variable (at your own risk since this default variable brings in a lot of HubSpot scripts needed to power specific functionality). One such filter that can help you here is the replace filter which I've linked.

 

Something like the following should work:

{{ standard_header_includes|replace('<script>fetch the script here</script>', '')}} 

 

Some other ways people have found helpful in manipulating this variable are highlighted in the post here: https://community.hubspot.com/t5/CMS-Development/How-to-use-standard-header-includes-without-loading...

 

I generally like to pprint out specific variables to see what's inside and try to filter down what I want from there. If you can share specific scripts/stylesheets that you're unsure about, I can see if there is more context I can provide based on my experience.

 

For now, the above should allow you to manipulate this variable as you need although be warned that improperly setting this up could impact things like analytics from HubSpot's end.

BérangèreL
Community Manager
Community Manager

Not sure how to disable third party cookie initiators being loaded in standard_header_includes

SOLVE

Hi @WBottlick and welcome, it's a pleasure to have you here!

Thanks for reaching out to the HubSpot Community!

Here is some information on the topic:

- Cookies set in your visitor's browser by HubSpot
- HubSpot consent banner | Frequently asked questions

I'd love to put you in touch with our Top Experts: Hi @trevordjones, @TomM2 and @Anton do you have suggestions to help @WBottlick, please?

Have a lovely day and thanks so much!
Bérangère





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes