Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

79
Vistas
how do i stop google analytics from tracking a webpage from my options in VueJs or NuxtJs

I have set up google analytics in my NuxtJs app, I also have cookies that save the preferences of the users. when the user rejects the cookies, I set a cookie where Cookie.set('disableAnalytics', true);

and also in my nuxt.config.js file, I have where

require('dotenv').config()
import Cookie from 'js-cookie';

export default {
    googleAnalytics: {
        id: process.env.GOOGLE_ANALYTICS_ID,
        disableScriptLoader: Cookie.get("disableAnalytics") || false
    }
}

I EXPECT that it somehow disables the script loader, and cause google analytics to not track the user.

BUT THIS IS NOT THE CASE, when I check the analytics console while visiting the site, Google analytics is still tracking.

Please, How can I solve the problem, and stop google analytics from tracking when the disableAnalytics cookie is set to true?

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos