Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: #682

Closed
Locis1 opened this issue May 5, 2024 · 1 comment
Closed

[Bug]: #682

Locis1 opened this issue May 5, 2024 · 1 comment
Labels
invalid This doesn't seem right

Comments

@Locis1
Copy link

Locis1 commented May 5, 2024

Expected Behavior

No errors in the console

Current Behavior

At the beginning I imported the js via cdn, but now I would like to have it locally, since then I have been getting the following error message all the time. Is it a bug in the project or is my code wrong.

image

Steps to reproduce

Thats my Config.

import "./cookieconsent.umd.js";

// Enable dark mode
document.documentElement.classList.add("cc--darkmode");

CookieConsent.run({
  guiOptions: {
    consentModal: {
      layout: "box inline",
      position: "bottom left",
      equalWeightButtons: true,
      flipButtons: false,
    },
    preferencesModal: {
      layout: "box",
      position: "right",
      equalWeightButtons: true,
      flipButtons: true,
    },
  },
  cookie: {
    name: "cc_locis",
    domain: location.hostname,
    path: "/",
    sameSite: "Lax",
    expiresAfterDays: 365,
  },
  categories: {
    necessary: {
      readOnly: true,
    },
    analytics: {
      autoClear:{
        cookes:[
          {
            name: /^_ga/,   // regex: match all cookies starting with '_ga'
        },
        {
            name: '_gid',   // string: exact cookie name
        }
        ]
      }
    },
  },
  language: {
    default: "de",
    translations: {
      de: {
        consentModal: {
          title: "Hallo Reisende, es ist Kekszeit!",
          description:
            'Diese Seite nutzt einwilligungsbedürftige Cookies und Technologien von Drittunternehmen zur Integration bestimmter Funktionen. Wenn Sie auf den Button "Alles akzeptieren" klicken, werden diese Funktionen aktiviert (Einwilligung). Nach der Einwilligung verarbeiten wir und die betroffenen Drittunternehmen Ihre personenbezogenen Daten für verschiedene Zwecke. Detaillierte Informationen zu Zweck, Rechtsgrundlagen, Drittunternehmen können Sie unter dem Button "Mehr" und in unserer Datenschutzerklärung einsehen. Sie können Ihre Einwilligung jederzeit widerrufen.',
          acceptAllBtn: "Alle akzeptieren",
          acceptNecessaryBtn: "Alle ablehnen",
          showPreferencesBtn: "Einstellungen verwalten",
          footer:
            '<a href="#link">Impressum</a>\n<a href="#link">Datenschutzerklärung</a>',
        },
        preferencesModal: {
          title: "Präferenzen für die Zustimmung",
          acceptAllBtn: "Alle akzeptieren",
          acceptNecessaryBtn: "Alle ablehnen",
          savePreferencesBtn: "Einstellungen speichern",
          closeIconLabel: "Modal schließen",
          serviceCounterLabel: "Dienstleistungen",
          sections: [
            {
              title: "Verwendung von Cookies",
              description:
                "Mit diesem Tool können Sie Ihre Zustimmung zur Erfassung und Verarbeitung personenbezogener Daten durch Technologien von Drittanbietern verwalten.",
            },
            {
              title:
                'Streng Notwendige Cookies <span class="pm__badge">Immer Aktiviert</span>',
              description:
                "Diese Technologien sind erforderlich, um die wesentlichen Funktionen unseres Dienstes zu aktivieren.",
              linkedCategory: "necessary",
              cookieTable: {
                caption: "Cookie table",
                headers: {
                  name: "Locis Cookies",
                  domain: "locis-media.de",
                  desc: "Diese Cookies dienen dazu, Ihre individuellen Cookie-Einstellungen zu speichern.",
                },
                body: [
                  {
                    name: "cc_locis",
                    domain: location.hostname,
                    desc: "Diese Cookie dient der Speicherung Ihrer getroffenen Cookie Einstellungen",
                  },
                ],
              },
            },
            {
              title: "Analytische Cookies",
              description:
                "Diese Website verwendet Google Analytics, einen Webanalysedienst der Google LLC. Google Analytics verwendet Cookies, um die Website-Nutzung zu analysieren und zu verbessern.",
              linkedCategory: "analytics",
              cookieTable: {
                caption: "Cookie table",
                headers: {
                  name: "Google Cookies",
                  domain: location.hostname,
                  desc: "Google Analytics-Cookies helfen uns, die Website-Nutzung zu verstehen und zu verbessern, indem sie Daten wie IP-Adresse, Browsertyp und besuchte Seiten sammeln.",
                },
                body: [
                  {
                    name: "_ga",
                    domain: location.hostname,
                    desc: "Dieses Cookie wird von Google Analytics verwendet, um eindeutige Benutzer zu unterscheiden. Es wird bei jedem Seitenaufruf gesetzt und hat eine Lebensdauer von 2 Jahren.",
                  },
                  {
                    name: "_gid",
                    domain: location.hostname,
                    desc: "Dieses Cookie wird von Google Analytics verwendet, um die Anfragerate zu drosseln. Es wird bei jedem Seitenaufruf gesetzt und hat eine Lebensdauer von 24 Stunden.",
                  },
                ],
              },
            },
            {
              title: "Weitere Informationen",
              description:
                'Bei Fragen zu meiner Richtlinie zu Cookies und Ihren Auswahlmöglichkeiten<a class="cc__link" href="#yourdomain.com"> KONTAKTIEREN</a> Sie mich bitte.',
            },
          ],
        },
      },
      en: {
        consentModal: {
          title: "Hello traveller, it's cookie time!",
          description:
            "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip.",
          acceptAllBtn: "Accept all",
          acceptNecessaryBtn: "Reject all",
          showPreferencesBtn: "Manage preferences",
          footer:
            '<a href="#link">Legal Notice</a>\n<a href="#link">Privacy Policy</a>',
        },
        preferencesModal: {
          title: "Consent Preferences Center",
          acceptAllBtn: "Accept all",
          acceptNecessaryBtn: "Reject all",
          savePreferencesBtn: "Save preferences",
          closeIconLabel: "Close modal",
          serviceCounterLabel: "Service|Services",
          sections: [
            {
              title: "Cookie Usage",
              description:
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
            },
            {
              title:
                'Strictly Necessary Cookies <span class="pm__badge">Always Enabled</span>',
              description:
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
              linkedCategory: "necessary",
            },

            {
              title: "Analytical Cookies",
              description:
                "This website uses Google Analytics, a web analytics service provided by Google LLC. Google Analytics uses cookies to analyze and improve website usage.",
              linkedCategory: "analytics",
              cookieTable: {
                caption: "Cookie table",
                headers: {
                  name: "Google Cookies",
                  domain: location.hostname,
                  desc: "Google Analytics cookies help us understand and improve website usage by collecting data such as IP address, browser type, and visited pages.",
                },
                body: [
                  {
                    name: "_ga",
                    domain: location.hostname,
                    desc: "This cookie is used by Google Analytics to distinguish unique users. It is set on every page load and has a lifespan of 2 years.",
                  },
                  {
                    name: "_gid",
                    domain: location.hostname,
                    desc: "This cookie is used by Google Analytics to throttle request rate. It is set on every page load and has a lifespan of 24 hours.",
                  },
                ],
              },
            },
            {
              title: "More information",
              description:
                'For any query in relation to my policy on cookies and your choices, please <a class="cc__link" href="#yourdomain.com">contact me</a>.',
            },
          ],
        },
      },
    },
    autoDetect: "browser",
  },
  disablePageInteraction: true,
});

Proposed fix or additional info.

No response

Version

3.0.1

On which browser do you see the issue?

Chrome

@Locis1 Locis1 added the bug Something isn't working label May 5, 2024
@github-actions github-actions bot added the triage yet to be reviewed label May 5, 2024
@orestbida
Copy link
Owner

There is nothing wrong with the provided config (runs fine on my end). Perhaps you unintentionally modified something inside cookieconsent.umd.js.

@orestbida orestbida added invalid This doesn't seem right and removed bug Something isn't working triage yet to be reviewed labels May 5, 2024
@Locis1 Locis1 closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants