# Cookie Update Event leer beim Akzeptieren aller Cookies

**URL:** <https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356>\
**Category:** Programmierung\
**Created:** [13. Januar 2022 um 20:05 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356 "2022-01-13T20:05:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![codiverse](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@codiverse](https://forum.shopware.com/u/codiverse)\
**Post date:** [13. Januar 2022 um 20:05 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/1 "2022-01-13T20:05:13Z")

</div>

Hi zusammen,

ich habe eine Frage zum JS Event, welches beim Klick auf den „Alle akzeptieren“ Button gedrückt wird.

Bisher war es so:

- man klickt auf Konfigurieren
- wählt die gewünschten Cookies aus
- speichert

Wenn man auf

```auto
document.$emitter.subscribe(COOKIE_CONFIGURATION_UPDATE, this.handleCookies.bind(this));

```

subscribed hat, kann man in der handleCookies Funktion so darauf reagieren

```auto
handleCookies(cookieUpdateEvent) {
        const updatedCookies = cookieUpdateEvent.detail;

        if (!Object.prototype.hasOwnProperty.call(updatedCookies, this.cookieEnabledName)) {
            return;
        }

        if (updatedCookies[this.cookieEnabledName]) {
            this.startGoogleAnalytics();
            return;
        }

        this.removeCookies();
        this.disableEvents();
    }

```

Wenn ich nun aber den „Alle akzeptieren Button“ drücke, enthält „updatedCookies“ aber NICHT die Namen der akzeptierten Cookies, sondern nur das Prototype Objekt. Dementsprechend bekomme ich erst beim PageReload die Info, dass meine Cookies jetzt akzeptiert sind. Mache ich etwas falsch? Wie kann ich am besten Live prüfen, ob meine Cookies akzeptiert wurden?

So sieht es aus wenn ich den „Alle akzeptieren“ Button verwende

 ![Screenshot at Jan 13 21-02-55](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/f/fa94b52912a3fa21374265a1f200609e34df7cf3.png)

So wenn ich es über „Konfigurieren“ mache

 ![Screenshot at Jan 13 21-03-58](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/9/99d8f0b5812a8ba5454615028dfa4917635d734b.png)

Kann mir jemand helfen?

---

<div class="post-metadata">

**Author:** ![codiverse](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@codiverse](https://forum.shopware.com/u/codiverse)\
**Post date:** [13. Januar 2022 um 20:13 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/2 "2022-01-13T20:13:00Z")

</div>

Das Ganze passiert übrigens NUR mit dem „Alle akzeptieren“ Button unten in der Leiste. Mit dem „Alle akzeptieren“ Button im Off Canvas Menu funktioniert es.

---

<div class="post-metadata">

**Author:** ![codiverse](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@codiverse](https://forum.shopware.com/u/codiverse)\
**Post date:** [22. März 2022 um 16:56 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/3 "2022-03-22T16:56:13Z")

</div>

Hat hier jemand inzwischen eine Lösung zu gefunden?

---

<div class="post-metadata">

**Author:** ![aragon999](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@aragon999](https://forum.shopware.com/u/aragon999)\
**Post date:** [4. April 2022 um 18:06 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/4 "2022-04-04T18:06:41Z")

</div>

> <https://github.com/shopware/platform/pull/2419>
>
> \### 1. Why is this change necessary?
> Currently, if the cookie accept all button… is activated, the cookies are not correctly passed to the JavaScript event \`CookieConfiguration\_Update\`.
> 
> \### 2. What does this change do, exactly?
> Set the initial state which is required to check for changed cookies. Note that the test actually checks this, but they worked since there in the \`beforeEach\` the method \`\_setInitialState\` was called. Not sure if there is something in addition which should be changed.
> 
> \### 3. Describe each step to reproduce the issue or behaviour.
> Subscribe to the event \`CookieConfiguration\_Update\` and see the cookies which are changed when accepting all cookies.
> Furthermore another side effect of this, which we noticed was, that the \`gclid\` was not transmitted to Google Analytics, since the event was not fired with the correct changed cookies. This has been fixed in addition by this PR, which still is relevant since the user could navigate to another page: https://github.com/shopware/platform/pull/2416
> 
> \### 4. Please link to the relevant issues (if any).
> https://issues.shopware.com/issues/NEXT-19535
> https://issues.shopware.com/issues/NEXT-20804
> 
> \### 5. Checklist
> 
> \- \[x\] I have written tests and verified that they fail without my change
> \- \[x\] I have created a \[changelog file\](https://github.com/shopware/platform/blob/trunk/adr/2020-08-03-Implement-New-Changelog.md) with all necessary information about my changes
> \- \[\] I have written or adjusted the documentation according to my changes
> \- \[\] This change has comments for package types, values, functions, and non-obvious lines of code
> \- \[x\] I have read the contribution requirements and fulfil them.

---

<div class="post-metadata">

**Author:** ![codiverse](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@codiverse](https://forum.shopware.com/u/codiverse)\
**Post date:** [5. April 2022 um 11:48 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/5 "2022-04-05T11:48:09Z")

</div>

Vielen Dank, @aragon999 !

---

<div class="post-metadata">

**Author:** ![codiverse](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@codiverse](https://forum.shopware.com/u/codiverse)\
**Post date:** [29. April 2026 um 11:04 UTC](https://forum.shopware.com/t/cookie-update-event-leer-beim-akzeptieren-aller-cookies/92356/6 "2026-04-29T11:04:37Z")

</div>

Hey @aragon999, kann es sein dass dein PR nie gemerged wurde? Ich habe das Problem in SW6.7.5.0 und SW6.7.8.0 immer noch.
