How to Add Google Analytics 4 (GA4) in Next.js 14 (GDPR opt-in Cookie Banner)

Поделиться
HTML-код
  • Опубликовано: 19 ноя 2024

Комментарии • 15

  • @codewithmoses
    @codewithmoses Месяц назад

    Honestly I was looking for this so long. Thanks for sharing.

  • @mafterr11
    @mafterr11 3 месяца назад +2

    First to make a tutorial about this properly..finally

    • @MaxRohowsky
      @MaxRohowsky  3 месяца назад +2

      haha yes, this was also my thought

    • @mafterr11
      @mafterr11 3 месяца назад +1

      @@MaxRohowsky was struggling with the cookie banner, not gonna lie... and nothing online.

    • @talakolavijaykumarreddy1843
      @talakolavijaykumarreddy1843 Месяц назад

      Not first actually the same video as made by @Ryan Gaudion way earlier

  • @brazilian_orthodox
    @brazilian_orthodox 3 месяца назад

    Thank you! Finally a good tutorial on the subject. Earned a sub.

    • @MaxRohowsky
      @MaxRohowsky  3 месяца назад

      haha I share the frustration. There really wasnt any good video out there. :D

  • @awais_ansarii
    @awais_ansarii 2 месяца назад

  • @BhargPatel-z9c
    @BhargPatel-z9c Месяц назад

    But script is not updating from "denied" to "granted". did you checked it?

  • @romanm9638
    @romanm9638 2 месяца назад

    Like, subscribe!

  • @sergiigulaga1486
    @sergiigulaga1486 Месяц назад +1

    I am not sure is good idea to embedded code without @next/third-parties/google . Your perfomance page can be low down.

    • @MaxRohowsky
      @MaxRohowsky  Месяц назад +1

      Interesting... didn't think that would be an issue...

  • @KaiWollherr
    @KaiWollherr 2 месяца назад

    Hi there, is there anyone who had the same issue? I cant set my buttons to true or false with this approach.
    setCookieConsent(false)}>
    Ablehnen

    setCookieConsent(true)}>
    Erlauben
    Initially its set to null like in the tutorial. Now it tells me that its not possible to set it to true or false.
    Argument of type 'false' is not assignable to parameter of type 'SetStateAction'.ts(2345)

    • @MaxRohowsky
      @MaxRohowsky  2 месяца назад

      Hi Kai, this typescript error happens when you try to set a boolean value to something that only accepts null. Change the code to useState(null).