Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add google analytics script tag #5437

Merged
merged 4 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions apps/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
-->
<title>Novu Manage Platform</title>
<script src="%PUBLIC_URL%/env-config.js"></script>
<!-- Google Tag Manager -->
<script>
(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', 'GTM-KXMC4XP2');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTM identifier should be taken from the env variables passed from the pipelines. It will be different per environment (dev/staging/prod).

Also are we sure that we want to use the same identifier for both EU and US regions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LetItRock

As per Justin's message in slack, it will be the same for all environments.

  • Added conditions and support of environment variables. I can remove these conditions and variables if you think it is not needed anymore.

</script>
<!-- End Google Tag Manager -->
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand All @@ -37,12 +51,27 @@
async="async"
type="text/javascript"
></script>
<% } %>

<% if ( process.env.REACT_APP_HUBSPOT_EMBED ) { %>
<% } %> <% if ( process.env.REACT_APP_HUBSPOT_EMBED ) { %>
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/<% process.env.REACT_APP_HUBSPOT_EMBED %>.js"></script>
<script
type="text/javascript"
id="hs-script-loader"
async
defer
src="//js.hs-scripts.com/<% process.env.REACT_APP_HUBSPOT_EMBED %>.js"
jainpawan21 marked this conversation as resolved.
Show resolved Hide resolved
></script>
<!-- End of HubSpot Embed Code -->
<% } %>

<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-KXMC4XP2"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->
</body>
</html>
Loading