Content security policy (CSP) blocking Google scripts

EBarcaru1
Member

Hi,

 

has anyone had this issue solved?
All my custom events triggers are being rejected. What kind of script did you add to HS to make it work?


Thank you!

0 Upvotes
2 Replies 2
EBarcaru1
Member

Hi Shane,

I found this HubSpot consent script I added on a GTM tag, is this valid? 


<script>
window.dataLayer = window.dataLayer || [];

// Listen for HubSpot consent acceptance
document.addEventListener('hubspot_consent_ready', function(event) {
var consent = event.detail || {};

// Map HubSpot categories to Google consent
window.dataLayer.push({
event: 'update_consent',
ad_storage: consent.marketing ? 'granted' : 'denied',
analytics_storage: consent.analytics ? 'granted' : 'denied'
});
});
</script>

Thak you,

Elena

0 Upvotes
STierney
Community Manager
Community Manager

Hey @EBarcaru1 - thanks for posting in the Community!

I'd like to tag in some experts to see what insight they may have for us! @Syeda_Fatima, @ashleyidesign, and @nickdeckerdevs1 - any thoughts for @EBarcaru1 on why their custom events triggers are being rejected?

Shane, Senior Community Moderator





loop


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

Learn More




0 Upvotes