Commit d954118d authored by Tyler Williams's avatar Tyler Williams

Fix Google Tag Manager nonce value missing

parent 5ce39ad4
- return unless google_tag_manager_enabled?
- if Feature.enabled?(:gtm_nonce, type: :ops)
= javascript_tag do
= javascript_tag nonce: content_security_policy_nonce do
:plain
(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;var n=d.querySelector('[nonce]');
n&&j.setAttribute('nonce',n.nonce||n.getAttribute('nonce'));f.parentNode.insertBefore(j,f);
'https://www.googletagmanager.com/gtm.js?id='+i+dl;j.setAttribute('nonce',
'#{content_security_policy_nonce}');f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','#{google_tag_manager_id}');
- else
= javascript_tag do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment