How to add Google Analytics to your React/Next.js app

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

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

  • @linchen5913
    @linchen5913 Год назад +14

    For latecomers, this video is not using the Script tag that's introduced after Next 11, so be careful using the same method. Nice video!

    • @vivekgupta1287
      @vivekgupta1287 Год назад +1

      can you please describe how to add this in new next js ?

    • @shivamanand6112
      @shivamanand6112 Год назад

      figured out?@@vivekgupta1287

  • @ziyadsalem1068
    @ziyadsalem1068 Год назад

    Minute 8:55! That is what fixed my problem with calling an env variable in my code. Thank you!

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      Glad it helped!

    • @jotaroisdarius1918
      @jotaroisdarius1918 Год назад +1

      don't forget that the ones that start with NEXT_PUBLIC can be seen by anyone

    • @ziyadsalem1068
      @ziyadsalem1068 Год назад

      @@jotaroisdarius1918 damn, is there a private method?

    • @jotaroisdarius1918
      @jotaroisdarius1918 Год назад

      Well, the next_public doesnt really do anything by itself, it's a way to remind you that your variable is public, the ones that dont start with next_public are meant to be private and used only on the server like api handlers, use server and server components

  • @minhhieple6483
    @minhhieple6483 Год назад +1

    This video not available on Next.js version 13.

  • @CodingCurricula
    @CodingCurricula Год назад +1

    Is there a reason to include the Google Analytics tag as an environmental variable? It's in the of the doc so you'll download it with the page regardless.

    • @ChrisCooper0
      @ChrisCooper0  Год назад +2

      Good point, I only did that because it's used in multiple places so is easier to update in one place if I need to update the ID in the future

  • @ivankraev4264
    @ivankraev4264 10 месяцев назад

    Hey what library are you using for the scheduler ?

    • @ChrisCooper0
      @ChrisCooper0  10 месяцев назад

      Cal.com - Awesome OSS product

  • @raghunath-thilagar
    @raghunath-thilagar Год назад

    please do a video about adsense setup for next js 13

  • @TheFramerSchool
    @TheFramerSchool Год назад

    Great Video. I've been working on adding Google Analytics to my site. How to do it in Nextjs 13 App router case? With Typescript. Thanks Chris!

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      Nice! I'm not sure if there's any differences as not really worked with the new App router. Let me know how you get on!

    • @iamyoutubechannel
      @iamyoutubechannel Год назад +1

      @@ChrisCooper0 It is not working with latest App Router.

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

      You can use it in root layout.tsx 🙄

  • @francis81
    @francis81 Год назад

    Do we need to make the website go live or can we do it locally?

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      I believe it will work on localhost. Let me know if you give it a go!

  • @webupps
    @webupps Год назад +1

    Thanks Chris!

  • @ayushgogna9732
    @ayushgogna9732 Год назад

    does it work instantly or i have wait 48 hours to start seeing analytics coz i have done everything still dont see any data in analytics

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      Yeah it can take a while but should be there after 48 hours if everything is set up correctly

    • @KratosDzzz
      @KratosDzzz Год назад

      how to check if everything is set up correctly
      @@ChrisCooper0

  • @djelasrca8091
    @djelasrca8091 Год назад

    How I'm I not seeing events. I can only see js and config in dataLayer

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      Can you see them after completing all the steps?

    • @djelasrca8091
      @djelasrca8091 Год назад +1

      @@ChrisCooper0 the problem was that i had an ad blocker in my browser. It seems that add blockers block GA

  • @TornVeil7
    @TornVeil7 Год назад

    Is it updated for Google Analytics 4?

    • @ChrisCooper0
      @ChrisCooper0  Год назад

      I believe so but if I'm wrong the GA4 Setup Assistant looks to be useful

  • @jennarou7732
    @jennarou7732 Год назад

    This video is really good! God bless you!

  • @ankit.chaurasia
    @ankit.chaurasia Год назад +2

    This is very basic. It won't register pageviews on route change