In this tutorial, you will learn:
- How to verify your web site in your AdSense account.
- How to activate Site Authorization to prevent abuse of your AdSense code by sites that don’t belong to you.
- How to add automatic placement of AdSense ads for mobile and desktop visitors (called Page-level ads).
- How to test AdSense Page-level ads.
To follow along, please be certain that you have an approved AdSense account, and that you have the proper Privacy and Cookie Policy information in place on your web site, as per the Google AdSense policies.
First, let’s verify your site. This is a required step if wanting to use the QuickStart feature. QuickStart allows for the automatic, intelligent, placement of AdSense ads for mobile and desktop visitors to your web site.
- To verify your web site, within your Google AdSense account, click on Settings, then click My Sites.
- Click the Plus button.
- Type in your web site address in the box.
- Click Add Site.
At this point you may want to set it up so that *only* your authorized sites can display your AdSense.
Sometimes what happens is, another site will scrape the content of your web site, including your AdSense code, and then add that content to their site.
If that happens, and that site violates any AdSense policies, it’s you that can be affected by it. This step just prevents you from wishing you had done it sooner, if down the line something like this happens.
To setup Site Authorization:
- In the Manage Sites area, click the 3 stacked dots on the right side of the page.
- Click on Site Authorization.
- Turn it on, and click Save.
Now, let’s activate the auto-placement of ads on your web site.
To turn on this feature:
- In your AdSense account, go to My Ads, then Page-level Ads.
- Turn on one or both of Anchor/overlay ads and Vignette ads, by sliding the sliders.
- Open your WordPress Dashboard in a new Tab or Window.
The next step is to get the needed code for your web site to finalize the setup.
Worth noting though, that this code is the same code that newer AdSense users would have needed to add to their web sites during the application process. So, you may already have it in place, and can skip to the Testing section.
Long time users of AdSense did not need to place this code when applying, so these steps will be required.
Also, worth mentioning, is that this exact same code can be used on all pages of all your sites.
For this next step we are going to create a quick plugin to place the AdSense code on all pages of your WordPress web site.
I find that it’s extremely easy and fast to setup a plugin using the Pluginception plugin, so let’s get that installed first.
To install Pluginception, follow these steps:
- From within your WordPress Dashboard, click on Plugins, then click Add New.
- In the search box, type Pluginception.
- Click Install Now.
- Click Activate. This will open up a new option within the Plugins menu called Create a New Plugin.
Follow these steps to create your custom plugin:
- Click the Create a New Plugin link.
- Give the plugin a name such as My Google AdSense Placement Plugin.
- Click the Create a Blank Plugin button.
- Now, add the code into your plugin that you see in the video, or below these steps if you are following along within the written tutorial.
- Switch back to AdSense.
- Click the Get Code button.
- Copy the code to the Clipboard.
- Replace where it says YOUR ADSENSE CODE with the code copied from AdSense in the previous step.
- Click the Update File button.
There are two ways to test your work. Let’s do both right now.
- Visit your web site from your Desktop or Laptop computer.
- Right-click anywhere on the page and click View Source.
- Look for the code that you inserted. You can do a find, usually by pressing Ctrl+F and typing adsbygoogle as one word with no spaces.
- Now, let’s have a look to see if the ads show in Mobile. Open up a page on your web site with a high-end mobile device in Portrait view (as opposed to Landscape view). Add #googleads to the end of the URL.
- Select the ad format that you want to test, then check the results on your device.
- For vignettes, click any of the highlighted links on your page to test the ads are working.
If you are having problems displaying ads during testing, be sure to visit Google’s Guide to testing Page-level ads to see why that may be. Do a Google search for “Guide to testing Page-level ads” to find the page.
Code used within this tutorial:
function my_google_adsense_placement_function() { $output='YOUR ADSENSE CODE'; echo $output; } add_action('wp_head','my_google_adsense_placement_function');
Alternative Option for Adding Adsense
You can also use the simple adsense insertion plugin to add Google Adsense to your site.
Leave a Reply