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

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

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

  • @pro4v
    @pro4v 4 дня назад

    Very useful, nice touch including the github repo
    Thank you

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

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

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

    Amazing video, just wanted to confirm does the GoogleAnalytics component provided in next/thirdparties not doing everything? are somethings missing?

  • @brazilian_orthodox
    @brazilian_orthodox 5 месяцев назад +1

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

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

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

  • @mafterr11
    @mafterr11 5 месяцев назад +4

    First to make a tutorial about this properly..finally

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

      haha yes, this was also my thought

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

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

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

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

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

    How to do it with GTM?

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

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

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

    Like, subscribe!

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

  • @sergiigulaga1486
    @sergiigulaga1486 4 месяца назад +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  3 месяца назад +1

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

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

    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  4 месяца назад

      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).