Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add last improvements to GTM tag logic

Carlos Monastyrski497e809e780a
diff --git a/backend/src/server/plugins/serve-ui.ts b/backend/src/server/plugins/serve-ui.ts
index 1dfa1c8b6d..a12b7ee423 100644
--- a/backend/src/server/plugins/serve-ui.ts
+++ b/backend/src/server/plugins/serve-ui.ts
@@ -120,6 +120,11 @@ export const registerServeUI = async (
const regex = new RE2(`(${directive}\\s+[^;]+)(;)`, "g");
indexHtml = indexHtml.replace(regex, `$1 ${domains.join(" ")}$2`);
}
+
+ indexHtml = indexHtml.replace(
+ "<!-- GTM_NOSCRIPT_PLACEHOLDER -->",
+ `<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WL5C7MWT" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>`
+ );
}
await server.register(staticServe, {
diff --git a/frontend/index.html b/frontend/index.html
index b2974855b4..1b877695c7 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -31,10 +31,7 @@
<script src="/runtime-ui-env.js"></script>
</head>
<body>
- <!-- Google Tag Manager (noscript) -->
- <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WL5C7MWT"
- height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
- <!-- End Google Tag Manager (noscript) -->
+ <!-- GTM_NOSCRIPT_PLACEHOLDER -->
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>