How to Add Google Adsense in Next.js 14

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

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

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

    I become This error Message
    AdSense Head Tag doesn’t support data-nscript attribute

  • @prasadbeligala
    @prasadbeligala 4 месяца назад +3

    Very useful video. Thank you.

  • @codewithshriekdj
    @codewithshriekdj 2 месяца назад +1

    I Also Created Same Video But i had the other issue of it have one flaw of the ad loading only if the page is visited first time but if i try to navigate it does load (you have to refresh page for it) so i added dependency of usepathname value and useSearchParams of 'next/navigation' of app router which solves this issue.

  • @gjohnsx
    @gjohnsx 5 месяцев назад +2

    great video thank you

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

    Thank you very much

  • @factwithhunny078
    @factwithhunny078 6 месяцев назад

    Hey I am facing the issue in my console

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

    Showing the same error. I can see these boxes on development and production also. I can not see any ads.

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

      did you finally see it, mine is the same

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

    Hey, can you tell me how to add adsense ads in astro js site?

  • @GabrielLogan17
    @GabrielLogan17 4 месяца назад +1

    Why you hide the ID numbers if this is visible on the public website ?

    • @webdevjan
      @webdevjan  4 месяца назад +1

      Didn't necessarily wanted people to know what my websites are

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

      @webdevjan ah ok, I see, so there's no problem to me exposed that, right ? Any security problems ?

    • @webdevjan
      @webdevjan  4 месяца назад +2

      @@GabrielLogan17 No, absolutely not. The publisher id will always be exposed to the client, so no worries :)

    • @GabrielLogan17
      @GabrielLogan17 4 месяца назад +1

      @@webdevjan By the way, thanks.

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

    Thank you so much bro

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

    How to do video ads?

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

    Doesnt work for me. I follow these steps, but in production I have that issue "DO NOT SUBMIT disabled?" and google API returns 400 error code

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

      Hi! Did you make sure your ID has only the number after, without 'ca-pub-'? because I think he made a mistake in the video, using 'ca-pub-{id}' when integrating AdSense, only the Id is needed

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

      @@thomasmoser4871 I use “ca-pub-id”. Because on google docs this is the right way. But I will try with only id

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

    Bro monetag in nextjs

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

    do we need cookie banner for Adsense? what if user denies to have cookie, will Adsense revenue drop?

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

      AdSense has an inbuilt cookie consent screen that you need to enable in their dashboard. Once done, as soon as you load the adsense script as shown in the video, the cookie consent screen should automatically show.

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

      And yeah if they don't consent, they won't see ads. I have a 97% consent rate on all my pages together. People are used to hitting "Consent" so don't worry too much about it

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

      @@webdevjan thanks for letting me know this things. Also, i use google analytics for which i have been using banner, so after adsense, do i have to show 2 banner? One for adsense (turned on from dashboard) and another for google analytics?

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

    Hello, do I need to create different display ads in google ads dashboard to have different id to put in different ad section in my website or I just have to create one and google will show different types of ads on each section? also thanks for this video

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

      Hey, in the ads section of adsense, you'll find both manual and auto ads.
      With auto ads, you can enable various types of ads like vignette ads and anchor ads. Auto ads are already enabled and loaded into your website by just injecting the adsense script as shown in the video.
      If you want to include custom ads, simply create responsive custom ads for each section of your page. Each of them will give you a unique id.
      For example, if you have a header, create a specific ad for that section. Similarly, if you want floating side panels that are positioned absolutely, create separate ads for them too.
      This will make it much easier to seperate and identify strong ads in analytics.

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

      @@webdevjan Thank you so much

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

    For your error, I'd say, set reactStrictMode: false in your next.config.js file

    • @GabrielLogan17
      @GabrielLogan17 4 месяца назад +3

      This is a st u p i d recommendation.... It's like type everything any and it should work..

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

    This video lacks, it doesn't show the ads running locally, which by default they don't run.

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

      You can't "run" ads locally...
      Google adsense doesn't provide you with an option to whitelist stuff like localhost.
      Add proper placeholders to avoid layout shifts and verify that the ads are loaded just as demonstrated in the video.
      Once you deploy to production and adsense accepted your domain you will see the ads.
      How do I know? I have 3 websites that are using the same code and are all using adsense without any issues.

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

      @@webdevjan i saw some options for Adsense on local, trying to test that!

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

    a

  • @boonfeiybf17
    @boonfeiybf17 2 месяца назад +1

    I think the minor annoying error is because might get push() a few times so I change the code slightly, and the error goes away.
    useEffect(() => {
    const initializeAds = () => {
    if (typeof window !== "undefined" && (window as any).adsbygoogle) {
    try {
    ((window as any).adsbygoogle = (window as any).adsbygoogle || []).push({});
    } catch (error: any) {
    console.log(error.message);
    }
    }
    };
    initializeAds();
    }, []);

    • @marco.braghim
      @marco.braghim 5 дней назад

      The error is gone, but the ads never shows...