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
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions apps/web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=
IS_TEMPLATE_STORE_ENABLED=
IS_MULTI_PROVIDER_CONFIGURATION_ENABLED=
IS_MULTI_TENANCY_ENABLED=
REACT_APP_NOVU_GTM_ID=
40 changes: 36 additions & 4 deletions apps/web/public/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google Tag Manager -->
<% if ( process.env.REACT_APP_NOVU_GTM_ID ) { %>
<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', '%REACT_APP_NOVU_GTM_ID%');
</script>
<% } %>
<!-- End Google Tag Manager -->
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon-gradient.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down Expand Up @@ -28,6 +44,18 @@
<script src="%PUBLIC_URL%/env-config.js"></script>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<% if ( process.env.REACT_APP_NOVU_GTM_ID ) { %>
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=%REACT_APP_NOVU_GTM_ID%"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe>
</noscript>
<% } %>
<!-- End Google Tag Manager (noscript) -->
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<% if ( process.env.REACT_APP_DOCKER_HOSTED_ENV === 'false' ) { %>
Expand All @@ -37,11 +65,15 @@
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 -->
<% } %>
</body>
Expand Down
Loading