From 4a156e315968dfb49f1738b5d209e36fcfea6414 Mon Sep 17 00:00:00 2001 From: "noa.santo" Date: Wed, 30 Oct 2024 17:44:28 +0100 Subject: [PATCH] feat: move leadinfo into cookie consent --- .../de/cookie-consent-translations.json | 24 ++++++++++++++++++- .../en/cookie-consent-translations.json | 24 ++++++++++++++++++- src/components/cookie-consent.tsx | 10 ++++---- src/components/layout/leadinfo-script.tsx | 11 ++++++++- src/pages/index.tsx | 2 -- 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/src/assets/locales/de/cookie-consent-translations.json b/src/assets/locales/de/cookie-consent-translations.json index 95ace6600..930af1a95 100644 --- a/src/assets/locales/de/cookie-consent-translations.json +++ b/src/assets/locales/de/cookie-consent-translations.json @@ -20,7 +20,29 @@ { "title": "Leistungs- und Analyse-Cookies", "description": "Diese Cookies helfen uns zu analysieren, wie Besucher mit unserer Website interagieren, und ermöglichen es uns, die Leistung zu messen und zu verbessern. Sie sammeln Informationen in anonymer Form.", - "linkedCategory": "analytics" + "linkedCategory": "analytics", + "cookieTable": { + "headers": { + "name": "Name", + "domain": "Dienst", + "description": "Beschreibung", + "expiration": "Ablauf" + }, + "body": [ + { + "name": "_li_id", + "domain": "Leadinfo.com", + "description": "Leadinfo platziert zwei Cookies, die Satellytes nur Einblicke in das Verhalten auf der Website geben. Diese Cookies werden nicht mit anderen Parteien geteilt. Datenschutzerklärung von Leadinfo", + "expiration": "_li_id wird für zwei Jahre gespeichert" + }, + { + "name": "_li_ses", + "domain": "Leadinfo.com", + "description": "Leadinfo platziert zwei Cookies, die Satellytes nur Einblicke in das Verhalten auf der Website geben. Diese Cookies werden nicht mit anderen Parteien geteilt. Datenschutzerklärung von Leadinfo", + "expiration": "_li_ses wird nur für die aktuelle Sitzung verwendet" + } + ] + } }, { "title": "Weitere Informationen", diff --git a/src/assets/locales/en/cookie-consent-translations.json b/src/assets/locales/en/cookie-consent-translations.json index a6dd424cf..f6e5a0957 100644 --- a/src/assets/locales/en/cookie-consent-translations.json +++ b/src/assets/locales/en/cookie-consent-translations.json @@ -20,7 +20,29 @@ { "title": "Performance and Analytics Cookies", "description": "These cookies help us analyze how visitors interact with our website, allowing us to measure and improve performance. They collect information in an anonymous form.", - "linkedCategory": "analytics" + "linkedCategory": "analytics", + "cookieTable": { + "headers": { + "name": "Name", + "domain": "Service", + "description": "Description", + "expiration": "Expiration" + }, + "body": [ + { + "name": "_li_id", + "domain": "Leadinfo.com", + "description": "Leadinfo places two cookies that only provides Satellytes insights into the behaviour on the website. These cookies will not be shared with other parties. Privacy statement of Leadinfo", + "expiration": "_li_id will be saved for two years" + }, + { + "name": "_li_ses", + "domain": "Leadinfo.com", + "description": "Leadinfo places two cookies that only provides Satellytes insights into the behaviour on the website. These cookies will not be shared with other parties. Privacy statement of Leadinfo", + "expiration": "_li_ses is only used for the current session" + } + ] + } }, { "title": "More information", diff --git a/src/components/cookie-consent.tsx b/src/components/cookie-consent.tsx index 850ccb86b..92f17f82c 100644 --- a/src/components/cookie-consent.tsx +++ b/src/components/cookie-consent.tsx @@ -6,6 +6,7 @@ import * as CookieConsentLib from 'vanilla-cookieconsent'; import enCookieConsentTranslations from '../assets/locales/en/cookie-consent-translations.json'; import deCookieConsentTranslations from '../assets/locales/de/cookie-consent-translations.json'; import { useTranslation } from 'react-i18next'; +import LeadinfoScript from './layout/leadinfo-script'; export const CookieConsent = () => { const { t, i18n } = useTranslation(); @@ -43,10 +44,9 @@ export const CookieConsent = () => { loadAllBtn: t('iframemanager.youtube.load-all-button'), }, de: { - notice: - 'Dieser Inhalt wird von einer externen Quelle gehostet. Durch das Laden des Inhalts akzeptieren Sie die Nutzungsbedingungen von youtube.com.', - loadBtn: 'Video laden', - loadAllBtn: 'Video laden und nicht mehr fragen', + notice: t('iframemanager.youtube.notice'), + loadBtn: t('iframemanager.youtube.load-button'), + loadAllBtn: t('iframemanager.youtube.load-all-button'), }, }, }, @@ -77,5 +77,5 @@ export const CookieConsent = () => { }).then(); }, [i18n.language]); - return null; + return ; }; diff --git a/src/components/layout/leadinfo-script.tsx b/src/components/layout/leadinfo-script.tsx index 5e6ebc296..2fbd9a3c3 100644 --- a/src/components/layout/leadinfo-script.tsx +++ b/src/components/layout/leadinfo-script.tsx @@ -3,6 +3,10 @@ import { useEffect } from 'react'; const LeadinfoScript = () => { useEffect(() => { const script = document.createElement('script'); + script.setAttribute('type', 'text/plain'); + script.setAttribute('data-category', 'analytics'); + script.setAttribute('data-service', 'Leadinfo'); + 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; @@ -12,7 +16,12 @@ const LeadinfoScript = () => { document.head.appendChild(script); return () => { - document.head.removeChild(script); + const existingScript = document.querySelector( + 'script[data-service="Leadinfo"]', + ); + if (existingScript) { + document.head.removeChild(existingScript); + } }; }, []); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 2f97547c6..b6860297a 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,6 @@ export const Head = ({ data, location }: PageProps) => { locales={data.locales} /> - ); };