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.
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
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.
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.
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
@@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?
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
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.
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(); }, []);
Very much appreciated. Thanks for the video. 👍
I become This error Message
AdSense Head Tag doesn’t support data-nscript attribute
Very useful video. Thank you.
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.
great video thank you
Thank you so much bro
Hey I am facing the issue in my console
Thank you very much
Hey, can you tell me how to add adsense ads in astro js site?
Showing the same error. I can see these boxes on development and production also. I can not see any ads.
did you finally see it, mine is the same
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
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.
@@webdevjan Thank you so much
For your error, I'd say, set reactStrictMode: false in your next.config.js file
This is a st u p i d recommendation.... It's like type everything any and it should work..
do we need cookie banner for Adsense? what if user denies to have cookie, will Adsense revenue drop?
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.
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
@@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?
Why you hide the ID numbers if this is visible on the public website ?
Didn't necessarily wanted people to know what my websites are
@webdevjan ah ok, I see, so there's no problem to me exposed that, right ? Any security problems ?
@@GabrielLogan17 No, absolutely not. The publisher id will always be exposed to the client, so no worries :)
@@webdevjan By the way, thanks.
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
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
@@thomasmoser4871 I use “ca-pub-id”. Because on google docs this is the right way. But I will try with only id
How to do video ads?
This video lacks, it doesn't show the ads running locally, which by default they don't run.
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.
@@webdevjan i saw some options for Adsense on local, trying to test that!
Bro monetag in nextjs
a
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();
}, []);
The error is gone, but the ads never shows...