klaro-js icon indicating copy to clipboard operation
klaro-js copied to clipboard

Problems to show the window on start

Open janstieler opened this issue 10 months ago • 1 comments

Hello,

I integrate the klaro cookie consent through nodemodules in my website and also the config file. But I don't understand why it is loading directly with the class cookie-notice-hiddenadded.

This is my config file:

var klaroConfig = {
    version: 2,
    cookieName: 'klaro',
    elementID: 'klaro',
    lang: 'de',
    noNotice: true,
    poweredBy: '',
    storageMethod: 'cookie',
    testing: false,
    translations: {
        de: {
            privacyPolicyUrl: 'https://www.kdjfs.de/langerecht/datenschutz',
            consentModal: {
                title: 'Wir brauchen Ihre Zustimmung',
                description: 'Wir benötigen Ihre Zustimmung zur Verwendung von Cookies. ',
            },
            klaro: {
                description: 'Wir setzen einen Cookie, um den Zustand der getroffenen Auswahl im Cookie-Banner zu speichern.',
            },
            googlemaps: {
                description: 'Darstellung von Karten',
            },
            purposes: {
                essenziell: 'Essenziell',
                analytics: 'Statistiken',
                externalmedia: 'Drittanbieter Plugins'
            },
        },
    },

    // This is a list of third-party services that Klaro will manage for you.
    services: [
        {
            name: 'klaro',
            title: "Technisch notwendiges Cookies",
            required: true,
            purposes: ['essenziell'],
            cookies: ['klaro', 'PHPSESSID'],
        },
        {
            name: 'googlemaps',
            default: false,
            title: 'Google Maps',
            purposes: ['externalmedia'],
            required: false,
            optOut: false,
            onlyOnce: true,
        },
    ],
};

And so I integrate it:

<script src="./assets/js/klaro.config.js"></script>
<script defer data-klaro-config="klaroConfig" type="application/javascript" src="./node_modules/klaro/dist/klaro.js"></script>

And can it be that the manual is for version 1?

Best

janstieler avatar Jan 28 '25 22:01 janstieler

@janstieler add

mustConsent: true,

to config. This should show the box imidiately.

https://codesandbox.io/p/live/72f29570-86ce-4102-af30-35dd54c2feed

MelchnerRoman avatar Feb 13 '25 15:02 MelchnerRoman