Skip to content

Commit

Permalink
Merge pull request Expensify#54782 from Expensify/arosiclair-tps-nonce
Browse files Browse the repository at this point in the history
Add nonce for Google Tag Manager script
  • Loading branch information
cristipaval authored Jan 3, 2025
2 parents 10de5ef + 04b4d38 commit 81186aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<link rel="shortcut icon" id="favicon" href="/favicon.png">
<% if (htmlWebpackPlugin.options.useThirdPartyScripts) { %>
<!-- Third party scripts -->
<script type="text/javascript" async="" src="/thirdPartyScripts.js"></script>
<script type="text/javascript" async="" src="/thirdPartyScripts.js" nonce="nonce-random-value"></script>
<!-- End Third party scripts -->
<% } %>
<link rel="manifest" href="/manifest.json" />
Expand Down
18 changes: 8 additions & 10 deletions web/thirdPartyScripts.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* eslint-disable */
/* prettier-ignore */

// Google Tag Manager
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
const f = d.getElementsByTagName(s)[0];
const j = d.createElement(s);
const 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', 'GTM-N4M3FLJZ');
(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);
})(window,document,'script','dataLayer','GTM-N4M3FLJZ');

// FullStory
window['_fs_host'] = 'fullstory.com';
Expand Down

0 comments on commit 81186aa

Please sign in to comment.