Adding AdSense to a WordPress sidebar using Advanced Ads

I’ve already shown you how to add ads to your WordPress site using the theme GeneratePress. If you’re interesting in setting up Advanced Ads I suggest you read through the post. It’s time to add some more and in this guide I’ll be showing you how to add AdSense ads to the sidebar of any WordPress website.

To accomplish this I’m going to be using groups inside of Advanced Ads. That way I can display individual ads for mobile and desktop devices. In this example I’m going with a Half page for desktops and a Medium rectangle for mobile devices. As the Half page is set to only display on desktops we should never see it on a mobile device.

As you can see in the screenshot, I selected Ordered ads. What I’ve also done is weighted the Half page heavier than the Medium rectangle. That way Advanced Ads will first attempt to display the Half page. If it figures out that the visitor is using a mobile device it won’t be able to display the Half page so it’ll go for the Medium rectangle.

Using Advanced Ads to create ad groups
Configuring Advanced Ads in the sidebar

With the group created we can navigate to Appearance and then select Widgets. Here we can drag an Advanced Ads widget into our Right Sidebar. Select the group we just created and click on save. Our AdSense ads will now be displayed in the sidebar.

Sticky AdSense ads in the sidebar

Using the WordPress plugin Q2W3 Fixed Widget for WordPress we can create “sticky” ads in the WordPress sidebar. These ads will “stick” to the top of the page as the user scrolls down.

The Fixed Widget Options are pretty easy to understand. You’ll want to set a top margin if your website uses a sticky navigation menu. Otherwise it’ll overlap the ad. The same goes for the bottom margin. If it overlaps anything adjust that number upwards.

The settings for Q2W3 Fixed Widget

To “unstick” the ad you can set a Stop ID. In GeneratePress’ a good ID for that is called footer-widgets. If you don’t set this the ad will just keep on going and overlap your footer widgets.

Making an ad in the WordPress sidebar sticky

One more thing you might want to adjust is the Disable Width. I set mine to 1024 which is the desktop breakpoint of GeneratePress. This will disable fixed widgets on mobile devices.

Go back into the Widgets screen and select the ad we previously placed and enable the Fixed widget option. If we now visit our page you’ll see that the ad will stick to the top of your screen but not overlap the menu. That might help getting a few more impressions and clicks.

An example of a sticky ad on Lia & Liam

Photo by Ibrahim Rifath on Unsplash

GeneratePress 3 is here and it’s amazing

It’s here. We were presented a short teaser in the latest update to GeneratePress Premium and now we get our first glimpse of it. GeneratePress 3.0 has landed. And this…

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.