Google AdSense was the official WordPress plugin from Google for adding AdSense ads to your WordPress site. The plugin allows you to choose each template of your site and place ads according to your need. For example, you can place a 300×600 ad in your sidebar only for a blog posts and disable ad display on any specific page. The plugin also includes verification tool for Google Webmaster Tools account and places ads on the verified sites as per AdSense publisher guidelines.
Google changed the name of the plugin to “Google AdSense” from “Google Publisher”. Later, Google also discontinued this WordPress plugin. We left this article only for historical reference, check out separate article on how to insert ads in WordPress site if you want to insert AdSense ads. At this moment, you can use the official Google Site Kit plugin that allows you to integrate AdSense account and monitor earnings from WordPress dashboard.
Installing and Using the Plugin
Go to WordPress plugin repository and install Google AdSense plugin. Activate the plugin and access the settings page under “Settings > AdSense”. First step is to verify your site with Webmaster Tools account and then click on the “Manage Ads” button available under “Ad Manager” box.
Features of Google AdSense Plugin for WordPress
Plugin offers three basic functions:
- Verification of site with Google Webmaster Tools account
- Ad Manager for adding ads on your content
- Automated ads for mobile devices
It is mandatory to verify your site with Webmaster Tools account before you use Google AdSense plugin. Once your site is verified then click on “Manage ads” under “Ad Manager” to place ads on your site. First Google will analyse your site for better ad placement and at this point of time custom templates are not supported for ad placements though you can still use the plugin on custom templates.
Site analysis will show whether there are problems on your site like existing ad codes and custom templates or everything is fine.
After the analysis, you can choose the template like “Single Page” or “Single Post” and start placing the ads. Plugin will automatically show suitable places on the selected template where ad placement is supported.
You can just click on the placeholder to create ad on that spot and change the ad settings by clicking on the gear icon. If you do not find suitable place then you can add manual spots by modifying theme’s php files. Click on “Save & activate” button to enable ad display and Google will take sometime to start showing ads.
Next step is to activate “Automated Mobile Ads” option to enable your ads for a mobile layout when viewed in mobile devices. “Ad Manager” is used to place ads which will be displayed in desktop and mobile devices in the same format. For example, if you have placed an ad with 728×90 horizontal banner without activating “Automated Mobile Ads” then the same format of ad will be displayed both in desktop and mobile devices. “Automated Mobile Ads” will enable changing the ad format to suit viewing on mobile devices, probably in 300×250 format.
Google servers need some time to grasp the changes and display ads on your site. Each ad placement will add corresponding ad unit in your AdSense account. You can view these ad units similar to other ad units, under “My ads” tab and modify ad style from your AdSense account.
Disabling Ads on Specific Pages
As per AdSense policies, you can’t place ads on pages like “Newsletter” or “Thank You”. Google made this possible by adding the “Disable ads on this page” option on WordPress page editor. Disabling ads is only possible on pages and it is not possible to disable ads on specific posts.
This is a basic plugin from Google for WordPress publishers but there is still a long way to go for Google to enhance the plugin with more features and reporting functions.
Ad Placement in WordPress with Google AdSense Plugin
Google will start analyzing your site and display a message accordingly. Though this works fine on posts and pages, Google does not guarantee perfect display and placement on custom post types. You can choose the template file to see placeholder marks where Google spots possible ad placement.
If the identified placeholders satisfy you requirement then you can add three ads as per Google AdSense publisher guidelines and activate your changes. If the plugin does not detect a spot where you want to place an ad, then you need to modify theme’s core files to create a spot.
Modifying Theme Files for Creating Ad Spots
Assume you want to add an ad below your post content and the plugin does not detect that spot by default. Then go to “Appearance > Theme Editor” and choose the php file for your post (it is generally named as “single.php”). Place the below code at the end of the php file and update the file. Make sure to provide a unique name for your ad unit.
Now go back to the plugin and look for the ad placement of single post template. You will find a placeholder mark below your content exactly where you placed the ad code. Generally the ads are displayed on the live site when published but if you want to preview the insertion block outside AdSense plugin then modify the above code from “display : none” to “display : block” so that the ad block can be viewed during your testing or any other developments.
Once you finalized your placements don’t forget to change the code back to “display : none”.
If you see the placeholder in grey color then the plugin thinks that area you had inserted code is unclickable and you may need to use some other area for creating placeholder spot.
Adding AdSense Ads in Sidebar and Footer
It is very easy to add ads in your sidebar or footer using “Text” or “Custom HTML” widget. Drag and drop the “Text” widget and paste the below code inside the text area.
Adjusting Ad Format for Mobile Devices
Ad placement through “Ad Manager” will display ads in both desktop and mobile devices but the problem is the ad format will not be adjusted to suit mobile devices. For example, if you have placed 728×90 banner in the header of your site the same ad size will be displayed in mobile device as well making it not looking good.
Activate “Automated Mobile Ads” settings in order to auto adjust your ads to suit mobile devices. In the above example, the ad format will be changed to “320×50” format when viewed on mobile devices.
AdSense plugin was making it simple for publishers to add ad code along with webmaster tools verification and automated mobile ads. Though Google removed this plugin from WordPress repository, they have introduced a new Site Kit plugin. Site Kit has almost similar features with more capabilities to integrate other Google services. You can try to use the plugin to get all reporting within the WordPress admin dashboard.