From 41c31a78f9d1c3bcfda30c1c8613adb93291506f Mon Sep 17 00:00:00 2001 From: Dejan Zec Date: Fri, 30 Aug 2024 11:28:54 +0200 Subject: [PATCH] feat: change tracking script from leadfeeder to leadinfo --- src/components/layout/leadfeeder-script.tsx | 31 --------------------- src/components/layout/leadinfo-script.tsx | 22 +++++++++++++++ src/pages/index.tsx | 4 +-- 3 files changed, 24 insertions(+), 33 deletions(-) delete mode 100644 src/components/layout/leadfeeder-script.tsx create mode 100644 src/components/layout/leadinfo-script.tsx diff --git a/src/components/layout/leadfeeder-script.tsx b/src/components/layout/leadfeeder-script.tsx deleted file mode 100644 index 552e5c5a8..000000000 --- a/src/components/layout/leadfeeder-script.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { useEffect } from 'react'; - -const LeadfeederScript = () => { - useEffect(() => { - const script = document.createElement('script'); - script.innerHTML = ` - (function(ss,ex){ - window.ldfdr=window.ldfdr||function(){(ldfdr._q=ldfdr._q||[]).push([].slice.call(arguments));}; - (function(d,s){ - var fs=d.getElementsByTagName(s)[0]; - function ce(src){ - var cs=d.createElement(s); - cs.src=src; - cs.async=1; - fs.parentNode.insertBefore(cs,fs); - }; - ce('https://sc.lfeeder.com/lftracker_v1_'+ss+(ex?'_'+ex:'')+'.js'); - })(document,'script'); - })('ywVkO4XqrWdaZ6Bj'); - `; - document.head.appendChild(script); - - return () => { - document.head.removeChild(script); - }; - }, []); - - return null; -}; - -export default LeadfeederScript; diff --git a/src/components/layout/leadinfo-script.tsx b/src/components/layout/leadinfo-script.tsx new file mode 100644 index 000000000..5e6ebc296 --- /dev/null +++ b/src/components/layout/leadinfo-script.tsx @@ -0,0 +1,22 @@ +import { useEffect } from 'react'; + +const LeadinfoScript = () => { + useEffect(() => { + const script = document.createElement('script'); + script.innerHTML = ` + (function(l,e,a,d,i,n,f,o){if(!l[i]){l.GlobalLeadinfoNamespace=l.GlobalLeadinfoNamespace||[]; + l.GlobalLeadinfoNamespace.push(i);l[i]=function(){(l[i].q=l[i].q||[]).push(arguments)};l[i].t=l[i].t||n; + l[i].q=l[i].q||[];o=e.createElement(a);f=e.getElementsByTagName(a)[0];o.async=1;o.src=d;f.parentNode.insertBefore(o,f);} + }(window,document,'script','https://cdn.leadinfo.eu/ping.js','leadinfo','LI-66D184CC97CFD')); + `; + document.head.appendChild(script); + + return () => { + document.head.removeChild(script); + }; + }, []); + + return null; +}; + +export default LeadinfoScript; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 8419245d7..2f97547c6 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -11,7 +11,7 @@ import { } from '../types'; import { IGatsbyImageData } from 'gatsby-plugin-image'; import { StructuredOrganizationData } from '../components/pages/landingpage/structured-organization-data'; -import LeadfeederScript from '../components/layout/leadfeeder-script'; // Import the new component +import LeadinfoScript from '../components/layout/leadinfo-script'; // Import the new component export interface OfficeImage { relativePath: string; @@ -73,7 +73,7 @@ export const Head = ({ data, location }: PageProps) => { locales={data.locales} /> - + ); };