From 72653053c4eba11efe1a49992e8ac38f86c0f512 Mon Sep 17 00:00:00 2001 From: ipeke94 <26484292+ipeke94@users.noreply.github.com> Date: Sun, 29 Sep 2024 21:34:18 +0200 Subject: [PATCH] feat: test Cookiebot script --- src/components/layout/leadinfo-script.tsx | 22 ------------- src/pages/index.tsx | 39 +++++++++++++++++++++-- 2 files changed, 37 insertions(+), 24 deletions(-) delete mode 100644 src/components/layout/leadinfo-script.tsx diff --git a/src/components/layout/leadinfo-script.tsx b/src/components/layout/leadinfo-script.tsx deleted file mode 100644 index 5e6ebc296..000000000 --- a/src/components/layout/leadinfo-script.tsx +++ /dev/null @@ -1,22 +0,0 @@ -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 2f97547c6..f9cd0ab9a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -11,7 +11,6 @@ import { } from '../types'; import { IGatsbyImageData } from 'gatsby-plugin-image'; import { StructuredOrganizationData } from '../components/pages/landingpage/structured-organization-data'; -import LeadinfoScript from '../components/layout/leadinfo-script'; // Import the new component export interface OfficeImage { relativePath: string; @@ -73,7 +72,43 @@ export const Head = ({ data, location }: PageProps) => { locales={data.locales} /> - +