Skip to content

Commit

Permalink
#127 Consent Mode v2 improvement, render blocking third-party scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
DirkPersky committed Mar 27, 2024
1 parent ba0be0c commit b5e1938
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Configuration/TypoScript/Tracking/googleTagManager.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ page.headerData.998 {
15.wrap (
if(typeof window.tx_cookieconsent_init == 'undefined'){
window.tx_cookieconsent_init = true;
/* Google Tag Manager */
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','#');
/* End Google Tag Manager */

window.dataLayer = window.dataLayer || [];
if(typeof window.gtag == 'undefined') window.gtag = function() { window.dataLayer.push(arguments); };

window.gtag('consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
wait_for_update: 500
});

setTimeout(function(){
/* Google Tag Manager */
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','#');
/* End Google Tag Manager */
}, 0);
}
)
15.wrap.splitChar = #
Expand Down

0 comments on commit b5e1938

Please sign in to comment.