Skip to content

Commit

Permalink
Merge pull request #36471 from Expensify/dsilva_gtmAsAFile
Browse files Browse the repository at this point in the history
[No QA] Add GTM call as a file
  • Loading branch information
danieldoglas authored Feb 14, 2024
2 parents 36c7e8e + 98278b3 commit e22d282
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
{from: 'web/apple-touch-icon.png'},
{from: 'assets/images/expensify-app-icon.svg'},
{from: 'web/manifest.json'},
{from: 'web/gtm.js'},
{from: 'assets/css', to: 'css'},
{from: 'assets/fonts/web', to: 'fonts'},
{from: 'assets/sounds', to: 'sounds'},
Expand Down
11 changes: 11 additions & 0 deletions web/gtm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable no-param-reassign, prefer-template */
(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');
4 changes: 2 additions & 2 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
<!-- polyfill.io is only needed on Web to support older browsers. It should not be loaded for desktop -->
<script src="https://polyfill.io/v3/polyfill.min.js?features=default%2CResizeObserver&flags=gated"></script>
<% if (htmlWebpackPlugin.options.isProduction) { %>
<!-- Google Tag Manager - This was provided by our partner marketing agency -->
<script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-N4M3FLJZ"></script>
<!-- Google Tag Manager -->
<script async="" src="gtm.js"></script>
<!-- End Google Tag Manager -->
<% } %>
<% } %>
Expand Down

0 comments on commit e22d282

Please sign in to comment.