Uncaught TypeError error in console coming from Zaraz

I have implemented Zaraz on my website a month or so ago. It worked but now there is an error from Zaraz in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'push')

which references const dt = w.dataLayer.push;

Am I doing something wrong that is causing this?

1 Like

In addition, Zaraz Consent does not any longer get displayed.

image

If I disable “Data layer compatibility mode” in the Zaraz settings, the error is gone and the cookie consent modal is displayed again.

Does someone know why this might be?

Our domain runs a Next website, a React SPA, and KeyCloak for Authentication.
Zaraz consent is enabled for our domain.

With Data layer compatibility mode enabled, I get the following error in the console:

Uncaught TypeError: w.zaraz is undefined
    _rl s.js:5
    replaceState s.js:5
    wt keycloak.mjs:250

The error references Zaraz related code: const dt = w.dataLayer.push;.

With Data layer compatibility mode disabled, I get the a different error in the console but only for KeyCloak. But it’s a bigger problem than the previous error, since KeyCloak indefinitely tries to keep loading:

Uncaught TypeError: w.zaraz is undefined
    _rl s.js:5
    replaceState s.js:5
    wt keycloak.mjs:250

What to do? How can I make Zaraz consent work on our domain?