feat(hubspot-integration): dynamically load HubSpot script in production environment

- Added a script to conditionally load the HubSpot tracking script in the index.html file when the hostname matches 'app.worklenz.com'.
- Removed the HubSpot component from MainLayout to streamline the integration process.
This commit is contained in:
chamiakJ
2025-05-21 18:50:18 +05:30
parent d7ca1d8bd2
commit f716971654
2 changed files with 11 additions and 1 deletions

View File

@@ -48,6 +48,17 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="./src/index.tsx"></script>
<script type="text/javascript">
if (window.location.hostname === 'app.worklenz.com') {
var hs = document.createElement('script');
hs.type = 'text/javascript';
hs.id = 'hs-script-loader';
hs.async = true;
hs.defer = true;
hs.src = '//js.hs-scripts.com/22348300.js';
document.body.appendChild(hs);
}
</script>
</body>
</html>

View File

@@ -68,7 +68,6 @@ const MainLayout = () => {
<Outlet />
</Col>
</Layout.Content>
{import.meta.env.VITE_APP_ENV === 'production' && <HubSpot />}
</Layout>
</ConfigProvider>
);