Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Properly Add Google AdSense to Your WordPress Site

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to add Google AdSense to your WordPress website?

Google AdSense is one of the easiest ways to start making money online with your website. It allows you to automatically sell your website’s ad space to advertisers and get paid.

In this article, we will show you how to add Google AdSense in WordPress, along with some best practices and tips to increase your earnings.

How to Add Google AdSense to WordPress site

What is Google AdSense?

Google AdSense is an advertising network run by Google that allows bloggers and website owners an opportunity to earn money by showing text, images, videos, and other interactive advertisements on their websites. These ads are targeted by site content and audience, so they’re highly relevant.

Google AdSense is hassle-free because you don’t have to deal with advertisers or worry about collecting money. Google administers and maintains relationships with advertisers. They collect the payment, take their management fee, and send the rest of the money to you.

AdSense offers cost-per-click ads (CPC), which means that you earn money every time a user clicks on an ad on your website. The amount received per click varies based on a variety of factors.

Getting Started with AdSense

The first thing you need to do is sign up for a Google AdSense account. If you have a Gmail account, then you can use your existing account to sign up.

Once you’ve submitted your application, you will need to wait for the Google AdSense team to review it. This may take a few hours to a few weeks for some publishers.

Once it is approved, then you can log in to your AdSense account and get your ad code. This is the code that you need to place on your WordPress website to display ads.

With Google AdSense auto ads, you can paste just one piece of code and then Google automatically decides when, where, and how many ads to show on each page.

However, many publishers use the manual method to individually place ads on their websites.

We’ll show you both methods. We recommend starting with the manual ad placement first. Once you have started earning, then you can experiment with auto-ads to compare them yourself.

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, just keep reading.

1. Manually Place Google AdSense Ad Code in WordPress

You’ll start by clicking on the Ads menu in the left column and then switching to the ‘By ad unit’ tab. From here, you need to click on ‘Create New Ad.’

You will be asked to choose an ad type. You can select from Display ads, In-feed ads, and In-article ads.

If you are unsure, then start with the display ads.

Choose your unit

Next, you need to provide a name for this ad unit and select the ad size and type.

Enter details and select size

The name of the Ad is only used for internal purposes so you can name it anything like “SiteName Sidebar.”

The next option is choosing the Ad Size. While Google offers a wide variety of ad sizes, there are certain sizes that are listed under recommended because those are the most popular among advertisers. See our guide on the best Google AdSense banner sizes for more details.

You can also choose whether you want your ad to be responsive or fixed. We recommend choosing responsive ads as they work well on all devices and screen sizes.

Next, click on the ‘Create’ button to continue.

AdSense will now generate the ad code for you. It contains the unique ad unit ID and your publisher ID.

Copy the code

Simply copy your ad code and paste it into a plain text editor like Notepad or TextEdit. You will need it in the next step.

Adding Google AdSense in WordPress

Next, you need to determine where you want to show the ad on your website. Ads are most commonly displayed in the sidebar. You can add Google Adsense to your sidebar by using WordPress widgets.

Simply go to the Appearance » Widgets page in your WordPress admin area. Next, click the ‘+’ button to add a ‘Custom HTML’ widget block to the appropriate widget area.

Add custom HTML widget block

Next, you’ll need to enter the Google AdSense code in the Custom HTML widget block.

After that, don’t forget to click the ‘Update’ button.

Enter code and update widgets page

For better placement control and tracking, we recommend checking out a WordPress plugin like Advanced Ads or AdSanity.

You can see our guide on the best ad management WordPress solutions for more details.

2. Add Auto-Ads AdSense Code in WordPress

Adding individual ads to different areas of your website takes a lot of time. Most beginners struggle to find the best locations to display ads on their sites.

To solve this, Google introduced auto-ads. This allows you to simply add one code snippet to your site and let Google AdSense figure out the highest paying location, ad size, and type.

The disadvantage of this method is that you have less control over ad placement on your website.

If you want to use the auto-ads feature, then this is how you’ll add Google AdSense to your website.

First, log in to your Google AdSense account and click on the Ads tab. Next, you need to click on the ‘Get Code’ button to generate the auto-ads code.

Get code for auto placement

AdSense will now generate a code snippet with your publisher ID and display it. You can now copy and paste this code into a text editor.

Copy and paste the code

Adding AdSense Auto-Ads Code in WordPress

The auto-ads code uses a single code snippet to generate ads everywhere on your WordPress blog. This means you need to add the code to all the pages where you want to display the ad.

One way to do this is by adding the code to your WordPress theme’s header.php file. However, the disadvantage of this method is that your ad code will disappear if you update or change your theme.

The best way to add any site-wide code to your website is by using a plugin like WPCode.

WPCode

WPCode makes it safe and easy to add header and footer code in WordPress, without editing your theme files. This means that you’ll be able to save your ad code even if your theme changes.

First, you need to install and activate the free WPCode plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Note: The free version of WPCode has everything you need to add custom code snippets to your site. However, if you want advanced features like conversion pixels, scheduled snippets, code revisions, and more, you can upgrade to WPCode Pro.

Upon activation, go to the Code Snippets » Header & Footer page. From here, you need to paste your Google AdSense code in the header section.

Paste Google Adsense code in the header using WPCode

Don’t forget to click on the ‘Save Changes’ button to store your changes.

The plugin will now add the ad code on all pages of your website. It may take Google AdSense some time to start showing ads.

Related: See our guide on how to add header and footer code in WordPress for more details.

You can also use the WPCode plugin to automatically display Google AdSense ads in specific areas like before the beginning of a post, after a post, before or after a paragraph, and more.

For step by step instructions, see this guide on how to insert ads within your post content in WordPress.

AdSense Best Practices and Frequently Asked Questions

Over the years, we’ve answered several AdSense-related questions. Having used AdSense on several of our sites in the past, we’ve learned a whole lot about optimizing. Below are some AdSense best practices and frequently asked questions.

What’s the best AdSense Ad Size?

Although ad placement is key, we’ve found that the best sizes are 336×280 and 300×250. These ads tend to fit on most screen sizes and have the best pay rate as well.

What’s the Best AdSense Placement?

This entirely depends on your layout. The goal is to get more impressions and clicks, so you want to place your ads in a more prominent spot. We have found that ads within post content toward the top of the screen tend to get the most clicks.

Several users have asked us about adding AdSense in a floating widget because it will be very prominent. We strongly recommend against that because it is not allowed by Google Terms of Service. If you violate their TOS, then you can get banned from the program.

Can I click on my own Google AdSense Ads?

Often beginners are tempted to click on their own ads or ask their family members to click on their ads. Please don’t do that. Google’s algorithm is very smart and knows when you’re clicking on your own ad. This can get you banned from the program.

To learn more, see our guide on how to prevent invalid AdSense clicks in WordPress.

What is Page RPM in Google AdSense?

RPM stands for Revenue per Mille, meaning revenue per 1000 impressions. This is determined by multiplying the total number of clicks and cost per click and then dividing that by the total number of pageviews.

Can I use my Blogger or YouTube AdSense account with WordPress?

Yes, you can. If you started using AdSense on one of Google’s hosted platforms like Blogger or YouTube, then you can change your AdSense account type and use it with WordPress. You’ll need to provide Google AdSense with the URL of the site you want to monetize by filling out an application form.

Simply log in to your AdSense account and then under ‘My Ads’ click on the ‘Other Products’ option. Next, you need to click ‘Upgrade now’ and complete the application form.

What is CTR in Google AdSense?

CTR or click-through rates differ vastly for different kinds of websites. Your ad clicks depend on a lot of factors, like your website’s topics, your audience type, ad placement on your site, and more. The ideal CTR for Google AdSense is really hard to define because you don’t have access to the click rates of other websites like your own.

However, Google AdSense has built-in tools that will start showing you messages if your site is not getting a good CTR. You can follow the optimization guides shown inside the Google AdSense dashboard to improve your ad revenue.

You may also want to see our guide on how to set up Google Ads conversion tracking in WordPress.

When and how does Google AdSense pay publishers?

Each month, Google AdSense calculates your previous month’s earnings and shows them on your ‘Transactions’ page. If your earnings match the required threshold, then your payment is processed and released by the 21st of that month.

There are multiple payment methods available, including direct electronic transfer, wire transfer, check, Western Union, and more.

Why did Google AdSense reject my application?

Google Adsense may reject your application if your website is brand-new or otherwise doesn’t meet the AdSense program policies or their terms and conditions.

If they do, you could always consider using another ad management plugin or try another way to make money with your WordPress site.

What are the requirements to get Google AdSense application approved?

Here are the minimum requirements to get your Google AdSense account application approved.

  • Your website and all its content must comply with AdSense program policies and terms and conditions.
  • Your website should be at least 6 months old.
  • You, the applicant, must be over 18 years old.

Note: Even if your application meets all the requirements, Google AdSense still reserves the right to decline your application.

Can I add Google AdSense in my WordPress.com blog?

WordPress.com does not allow you to add Google AdSense to your website unless you upgrade to the Business plan. For more on this topic, please see our guide on the difference between WordPress.com vs WordPress.org.

What is the difference between Google AdSense vs Google AdWords?

Google AdWords allows you to advertise on other websites, including those participating in the Google AdSense program.

Google AdSense allows you to make money from your website by showing ads on your website.

How do I get rid of Adsense Ads?

If Google Adsense is displaying too many ads or you’re seeing ads in random places on your site, you’re probably using Google Adsense Auto ads.

To turn off Auto ads, sign in to your Adsense account and go to Ads » Overview. Next, click on the ‘Edit’ icon next to your website. You can disable the Auto ads options in ‘Site Settings’ to completely remove Auto ads on your site. Or, you can select the ‘Page Exclusions’ option to disable Auto ads from specific pages.

We hope this article helped you add Google AdSense to your WordPress site. You may also want to check out our guide on how to increase your blog traffic, and the best email marketing services to grow your subscribers.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

455 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    As for the best place to insert Google Adsense, I recommend using a heatmap analysis on the website first. This can be done by many tools. Heatmap is basically a tool that will show the most used place on the web. Meaning the physical location where users click the most. According to such an analysis, the position of the advertisement can be very well determined in order to be most successful.

  3. Mary says

    Question…how do I “block” the ads when I am logged in to my WordPress site? I got a warning email from Google about it. I need to develop a few pages and don’t know how to turn off ads for just when I’m logged in and developing.

    • WPBeginner Support says

      It would depend on how the ads are added and what tools you are using. Normally you shouldn’t see the front-end of your site when using the editor which wouldn’t load your ads.

      Admin

    • Peter Iriogbe says

      Additionally, If you’re using WordPress and want to block ads while developing, here’s a simple way: Just install an ad blocker extension on your web browser. This way, when you’re logged in and working on your site, the ads won’t bother you. It won’t affect how visitors see your site, just your view while working on it.

  4. CHUGEN says

    Hello Ma,am i really liked your tutorial but. ummm i have a question to the problem I am facing right now as a beginner, do I need to purchase premium subscription to install the desired plugins which are already displayed as free? please help with that issue.

  5. Craig says

    I see in the comments site kit was mentioned back in 2020. Now that it’s 2023 maybe they have worked out some bugs. I assume there are advantages and disadvantages to using the Google Site Kit plugin as opposed to manually generating ads as suggested in this post. Is manually generating the ads still your recommended method? Would you absolutely not use the Google Site Kit plugin for x.y.z reason? Asking for a friend ….

    • WPBeginner Support says

      If you are only using it for ads we would not recommend the site kit plugin and instead use the recommendations in the article. If you are already using the site kit plugin you can try their ad insertion if they still include it and see what you think! :)

      Admin

  6. Sualdam says

    Is it possible to have in-article ads (ones placed by me) randomised, so that using two inserts on a post shows two different ads?

    I’ve tried creating multiple ads, but the code is identical, and the same ad is shown at each refresh.

    • WPBeginner Support says

      If you are using Google Adsense then only Google would be able to offer those options for the time being.

      Admin

  7. Todd B says

    The Custom HTML block inserted extra HTML tags in the AdSense ad code, which broke it. I switched to an ad inserter plugin and pasted the plugin’s shortcode in the Shortcode block, and it worked.

  8. Sami says

    Hi, I have different question

    Can I scroll my website for checking if there is adsense ads or it will cause invalid activity? If so. how can I check? my website?

    • WPBeginner Support says

      You are allowed to view your site with Google Adsense ads, you would not want to click the ads as that is what Google wants to avoid.

      Admin

  9. Taofeek Kareem says

    Hello,please i am using auto ad to add Google Adsense to my site but instead of seeing the ads i am only seeing the code.
    I don’t really understand because am new to this.

  10. Tamara Bakoss Kutika says

    Hi, I need to add my Adsense code to the HEADER site, but once I do it, it creates a very huge white place before my website header. What can I do in order to elimante this huge place?

    • WPBeginner Support says

      The most likely reason would be if you’re using auto ads and Google is attempting to add an ad in that section of your site. If you use ad units instead of auto ads that would let you know if this is the issue.

      Admin

  11. Ziba Burrow says

    Thank you for this article.

    Are you able to choose the kind of ads that are displayed on your website?

    ie: auto ads but not soda ads

    • WPBeginner Support says

      You would control the allowed types of ads in your Adsense dashboard under their blocking controls.

      Admin

  12. Charles Etan says

    Very lovely piece for intender like me. My question is if I’m using a page builder to build my site, will this auto-ad code that I insert using insert header and footer plugin display ads on all my pages that I build with a page builder

  13. Lina says

    Hello sir, i hot approved by adsense and i started to show ads but my problem is that ads sometimes they appear and some times it show empty place, is that due because its new?

    • WPBeginner Support says

      Google may not have ads that would fit your specific site available at that time, you can reach out to Adsense’s support should you feel this is a continual issue.

      Admin

  14. MoneyManch says

    Thank you so much for this informative article because it really helped me. I just got Google AdSense approval today. Very nice article for beginners like me.

    Thanks once again for this helpful article.

  15. Aramide says

    Great Article, i love the content so much is so relevant and helpful. wpbeginers is full of great articles to learn from

  16. James says

    Hi, I have just had to deactivate site kite and remove the auto ads because they were breaking the centre column of a three column block being used as a image/gallery.

    Advice from WP forum- When you’re loading google adsense in the header like that, you may get wonky results bc it takes time for the browser to understand what it will be rendering, meanwhile the rest of the html is loading.

    • WPBeginner Support says

      Correct, the auto ads are attempting to learn your content, if you wanted a specific type of ad in that location you would want to use the manual ad code

      Admin

  17. Shyam Kumar says

    Even though I placed Adsense code for approval using Insert Headers and Footers, it still shows ‘The code is missing or incomplete’. Even though I tried 3-4 times but every time it comes up with the same issue. Please do help

    • WPBeginner Support says

      You would want to ensure you’ve cleared any caching and you don’t have a coming soon page up on your site for the most common reasons.

      Admin

  18. Anandakrishnan says

    I have a different doubt.
    I got my adsense activation code. To insert and activate adsense account should I delete the previously given verification html code?
    I am not using wordpress I am a blogger user.
    Please reply

    • WPBeginner Support says

      If you’re not using auto ads you can remove the verification code from your site.

      Admin

  19. francis says

    Hello my site is only one month and i have requested for adsense approval it is still saying “Getting ready…” do you think if everything is okay i will get approved even if the site is not 6month old? its now two weeks not approved yet

    • WPBeginner Support says

      That would be up to Google, they do not have a specific timetable for approving applications at this time.

      Admin

  20. Udhayakumar says

    Need your help.. I got a mail from Adsense

    The team has now reviewed it but unfortunately your site isn’t ready to show ads at this time. There are some issues which need fixing before your site is ready to show ads.
    For more information, visit the ‘Sites’ page in your account.

    What next I have to do?

    • WPBeginner Support says

      You would want to log into your account and Google should specify why they feel your site is not ready

      Admin

  21. Satrio says

    Hey, I got error when adding the snippet on the “Custom HTML” widget:
    1.Tag is not allowed
    2.Tag attribute … is not allowed

    I saw some post somehere that said I need to clear cache the browser, but it’s not working. The error still persist.

  22. randy says

    Hi there,

    Is it just as simple as past the code in the widget? I have tried but only sey a light grey block instead of the ad?

  23. Md Hasan Ali says

    Thanks for such informative post. I want to start a blogging website and earn money from Google Adsense. Will it any problem if I use free web theme?

  24. Heather says

    Thank you so much! I am wordpress illiterate and this is the first tutorial that actually helped me!!

  25. Jessica says

    Hi.

    Google Adsense place for posting code for wordpress site didnt work sorry… I saw you guys say to paste it into sidebar widget but google adsense says is not picking up the code in the site

  26. Clara Medina says

    I have my website for a year and 6 months and did everything in the video. However, it’s been months since I did it and there’s still not ads showing in my website. I’ve tried everything and nothing is happening.

    • WPBeginner Support says

      You would likely want to use Google’s Adsense troubleshooter for the ads not displaying.

      Admin

    • WPBeginner Support says

      Thank you for your feedback, we will certainly take a look at Google’s updates

      Admin

  27. lucky says

    Great article! Thanks.

    Can you please elaborate on :
    Your website should be at least 6 months old.

    Couldn’t find this in official policy page.

    • WPBeginner Support says

      They may have updated their policy to remove that requirement but having your content be that old still aids in getting your site approved

      Admin

  28. William says

    Hi WPbeginer,
    My Adsense is loaded on my webiste but it show as blank space. I inspect my Firefox browser and it showed that I have my ads code but it doesn’t show images. I check and confirm that my webiste is not baned by Google Adsense. Please advise.

    • WPBeginner Support says

      Adsense may not have an ad they would recommend for your site at that time. If you feel that there may be an error with the code you can check using the Google Adsense Troubleshooter to ensure the ad is set up correctly

      Admin

  29. bidaqiqa says

    Thank you so much, your article helped me properly setup Adsense on my site bidaqiqa.com that was very helpful guys. Thanks again :)

  30. Raakesh V says

    Thank you so much for your wonderful article. Today is a really unforgettable day for me. I get approved for my blog. It’s because of you only. Love you thanks for guiding me. I’m a new AdSense publisher now,

  31. Amy says

    Thank you. This was helpful. My ads disappeared with the latest ads.txt update and I had been having trouble getting them to show up again. With the help of this article I was able to ad a widget and I can collect my pennies from adsense again. :-)

  32. Amanda says

    How would I add code in between post paragraphs (beyond the sidebar)?

    I don’t want to clutter my sidebar because I already have a couple ads there. Thanks!

  33. Migdalis says

    Another great article. I’m a new blogger and I found all I needed to know to help me through the entire process right here on your page. God Bless you! Thank you for sharing your knowledge.

  34. Shekhar Chugh says

    Well, I need some more help…
    I am unable to activate Google Adsense for my website
    Can You help me???

    • WPBeginner Support says

      It would depend on the reason why your Adsense is not activating. You should receive an email or a message in your dashboard for why Adsens is not activating.

      Admin

  35. Dilber says

    i am trying to add adsense ad code in my header but it shows error 500, I tried both the method manual and by plugin but it shows the same, i already tried changing theme but it also doesn’t work , what to do know please help?

  36. Franklyn Fosu says

    Hi.
    Thanks a lot for this post.
    I have tried several times to save my AdSense verification code after pasting it in the header.php and ads widget but it doesn’t save. Tried so many times. It just keeps loading and never saves.
    Need your support to fix this issue because it’s been so many months I’ve struggled with this issue.
    Thank you and hope to hear from you soon.

  37. RAhul Kedia says

    I have submitted my website three times on Google Adsense but my Adsense has been disapproved and the reasons are your Url is a typo.

    What is the typo URL?
    How can I solve it?

    Help, Thank you

    • WPBeginner Support says

      You may want to ensure there isn’t another error message with that, otherwise, you would want to reach out to Adsense’s support for assistance.

      Admin

  38. Nabeel Arif says

    sir on my blog are not showing any single ad i’m facing this problem last 2 days.
    sir i’m confessed because when i open blog on Mobile where all ads are showing. But not showing on PC.
    Please help me how can i remove this problem

    • WPBeginner Support says

      You would need to reach out to Adsense for the specifics, more than likely there aren’t ads for the size you’re using as a possibility.

      Admin

  39. jessica says

    I have tried to use my adsense code but I can not add it in my widget and it will not work. The main error I get is “tag is not allowed.”

  40. Fanni says

    Hello!
    I tried to add my custom adsense html code to my side bar but it told me that is not allowed! What should I do? Do you have any solution for this?

  41. Sanaullah farooq says

    Hi sir, after WordPress update, I am not able to save this custom HTML Widget, when I add Adsense code the HTML Box taking a lot of time and not saving.

  42. Sonya says

    I’m looking to “upgrade” because I’ve switched from blogger to WP, but I can’t find the tabs following your instructions:
    “Can I use my Blogger or YouTube AdSense account with WordPress?”
    I don’t have “My Ads” and when I go under “Ads >> Other Products” I don’t have an upgrade options, it just gives me the option to monetize games and videos.
    What do I do?

    • WPBeginner Support says

      Sadly, with how often Google changes their methods, you would want to reach out to the adsense support to the current method

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.