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:
@@ -48,6 +48,17 @@
|
|||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="./src/index.tsx"></script>
|
<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>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -68,7 +68,6 @@ const MainLayout = () => {
|
|||||||
<Outlet />
|
<Outlet />
|
||||||
</Col>
|
</Col>
|
||||||
</Layout.Content>
|
</Layout.Content>
|
||||||
{import.meta.env.VITE_APP_ENV === 'production' && <HubSpot />}
|
|
||||||
</Layout>
|
</Layout>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user