Content security policy (CSP) blocking Google scripts

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!

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

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