Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
How can I use Javascript to validate that I have disabled or granted the correct consent?

I am setting my GA4 consent to denied, then updating it to granted if the user approves. I want to validate that the javascript behind my cookie consent banner is setting the correct consent settings in GA4. I'm not using GTM. I'm just calling the gtag() Javascript directly on each page.

Seeing in the documentation that there are update and set functions I opened the browser console and tried to get the consent config back out of gtag. Some things I tried:

gtag('get', 'consent');
gtag('config','get');

... and various combinations but these never return anything.

I then checked the Google documentation and there is indeed a get function but it doesn't seem to act on the consent command, following a different pattern of verbs.

Is there a way to validate from the console in a way whether I have set granted or denied to the permissions?

It would be very useful for automated functional UI testing (Selenium/WebDriver etc) too.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda