- Introduced a new HubSpot component that dynamically loads the HubSpot tracking script when in production. - Updated MainLayout to replace TawkTo with HubSpot for improved customer engagement tracking.
24 lines
571 B
TypeScript
24 lines
571 B
TypeScript
import { useEffect } from 'react';
|
|
|
|
const HubSpot = () => {
|
|
useEffect(() => {
|
|
const script = document.createElement('script');
|
|
script.type = 'text/javascript';
|
|
script.id = 'hs-script-loader';
|
|
script.async = true;
|
|
script.defer = true;
|
|
script.src = '//js.hs-scripts.com/22348300.js';
|
|
document.body.appendChild(script);
|
|
|
|
return () => {
|
|
const existingScript = document.getElementById('hs-script-loader');
|
|
if (existingScript) {
|
|
existingScript.remove();
|
|
}
|
|
};
|
|
}, []);
|
|
|
|
return null;
|
|
};
|
|
|
|
export default HubSpot;
|