How to Add Floating Sticky Sidebar Ads (Blogger & WP)

Sticky Sidebar Ads Blooger, is a code which will definetly improve your Google Search Ranking.


Benefits of Sticky Sidebar Ads Blooger

  • Your site Ranks faster than others.
  • Indexible faster.
  • Works Globally.
  • Blogger On-Page SEO Code

Steps for implanting Sticky Sidebar Ads Blooger

  • Login to Blogger Dashboard.
  • Go to Themes section.
  • Click on Edit HTML.
  • Paste the below code after <head> tag.
  • Click the save button.
Best No.1 : Sticky Sidebar Ads Blooger

Paste the code in html gadget/widget.{codeBox}



<div class='widget HTML' data-version='2' id='HTML4'>
<div class='widget-content'>
<style scoped='' type='text/css'>
.fixed-leftSd,.fixed-rightSd{position:fixed;top:60px;width:160px;height:600px;z-index:9999;transform:translateZ(0)}
.fixed-leftSd{left:0}
.fixed-rightSd{right:0}
.close-fixedSd{position:absolute;width:160px;height:15px;line-height:15px;font-size:11px;font-weight:400;top:-15px;left:0;text-align:center;background:#e0e0e0;color:#666;padding:5px 0;cursor:pointer}
@media screen and (max-width:800px){.fixed-leftSd,.fixed-rightSd{display:none;visibility:hidden;}}
</style>
<div class="fixed-leftSd">
<div aria-label="Close Ads" class="close-fixedSd" role="button" tabindex="0" onclick="this.parentElement.style.display=&quot;none&quot;">
<b>CLOSE ADS</b>
</div>
PASTE YOUR AD CODE HERE (Size 120*600)
</div>
<div class="fixed-rightSd">
<div aria-label="Close Ads" class="close-fixedSd" role="button" tabindex="0" onclick="this.parentElement.style.display=&quot;none&quot;">
<b>CLOSE ADS</b>
</div>
PASTE YOUR AD CODE HERE (Size 120*600)
</div>
</div>
</div>code-box


How to Add Floating Sticky Sidebar Ads in Blogger and WordPress (Step-by-Step Guide)


If you run a blog and earn from display ads, you have probably noticed that ads placed inside the content are scrolled past in seconds. A floating sticky sidebar ad solves part of that problem. It stays fixed on the left or right edge of the screen while the reader scrolls, so the ad remains in view for the whole time someone reads your article.

In this guide you will learn what sticky sidebar ads are, how to add them to a Blogger or WordPress site with working code, the real advantages and disadvantages, and how to place them without breaking Google's rules or hurting your page experience.

What Are Floating Sticky Sidebar Ads?

A floating sticky sidebar ad is an ad unit with a fixed screen position. Instead of moving away as the visitor scrolls, it stays in the same spot, usually in the empty margin beside your main content on a wide desktop screen.

These ads are also called side rail ads, sticky rail ads or fixed sidebar ads. They are built with a small amount of CSS (position: fixed) wrapped around a standard ad code, such as a Google AdSense display unit.

They are best suited to desktop and large tablet screens, because small phone screens have no spare margin space to hold them.

Why Use Sticky Sidebar Ads? (Advantages)

Here are the main benefits of adding floating sidebar ads to your site.

  1. Longer visibility. The ad stays on screen while the reader scrolls, so it can collect more viewable impressions than a normal in-content ad.
  2. Uses empty space. On wide monitors there is often unused space on both sides of the article. Side rails put that space to work without pushing your content down.
  3. Less intrusive than pop-ups. A slim ad at the edge of the screen is far less annoying than a full-screen overlay, and it does not block the text.
  4. Easy to set up. One snippet of HTML and CSS is enough. You do not need a plugin on Blogger.
  5. Works on any page type you choose. You can show the ads only on post pages, only on the homepage, or on both.
  6. Potential for higher earnings. Better viewability can improve ad performance and revenue. Results vary by niche, traffic and layout, so test and measure rather than assume.

Drawbacks to Know About (Disadvantages)

Sticky ads are not right for every site. Consider these downsides before you add them.

  1. Desktop only. The ads need free side space, so they usually do not show on mobile. If most of your visitors use phones, the benefit is small.
  2. Can feel distracting. An ad that follows the reader may annoy some visitors, which can raise bounce rates on content-focused sites.
  3. Layout conflicts. If your theme is already wide, the ads can overlap your content or sidebar and need extra CSS fixes.
  4. Possible speed impact. Two more ad requests add load time. Without reserved space they can also cause layout shifts, which hurt Core Web Vitals.
  5. Policy risk if placed badly. Ads that cover content, mislead visitors or encourage accidental clicks can break ad network policies and may put your account at risk.
  6. Fewer ad sizes. Side rails work best with tall units such as 120x600 or 160x600.

Before You Start: Requirements

  • A site with an approved Google AdSense account (or another ad network that allows fixed placements).
  • Your AdSense publisher ID (it looks like ca-pub-1234567890123456).
  • An ad slot ID from a display ad unit you create in AdSense.
  • A backup of your theme or site. Always do this before editing code.
  • A desktop screen wider than about 1300 pixels to test the result.

How to Get Your AdSense Publisher ID and Ad Slot ID

  1. Sign in to your AdSense account.
  2. Open Ads from the left menu, then choose By ad unit.
  3. Click Display ads and create a new unit. Choose a fixed size such as 120x600 (or 160x600) for a side rail.
  4. Click Create and copy the code. Note the values in data-ad-client (your publisher ID) and data-ad-slot (your slot ID).

How to Add Floating Sticky Sidebar Ads in Blogger

  1. Open your Blogger dashboard and go to Theme.
  2. Click the arrow beside the Customize button and choose Backup to download a copy of your theme.
  3. Click the same arrow and choose Edit HTML.
  4. Click inside the code editor and press Ctrl + F to search for </body>.
  5. Paste the code below just above the closing </body> tag.
  6. Replace ca-pub-XXXXXXXXXXXXXXXX and both XXXXXXXXXX slot values with your own IDs.
  7. Click Save, then open any blog post on a desktop to check the result.
<b:if cond='data:blog.isMobileRequest == &quot;false&quot; and data:blog.pageType == &quot;item&quot;'>
<style>
.rail-ad{position:fixed;top:90px;width:120px;height:600px;z-index:50}
.rail-ad.rail-left{left:10px}
.rail-ad.rail-right{right:10px}
.rail-close{display:block;width:120px;height:22px;margin:0 0 4px;padding:0;border:0;background:#e6e6e6;color:#444;font-size:11px;cursor:pointer}
@media screen and (max-width:1300px){.rail-ad{display:none}}
</style>

<div class='rail-ad rail-left'>
  <button type='button' class='rail-close' aria-label='Close ad' onclick='this.parentNode.style.display=&quot;none&quot;'>Close ad</button>
  <ins class='adsbygoogle' style='display:inline-block;width:120px;height:600px' data-ad-client='ca-pub-XXXXXXXXXXXXXXXX' data-ad-slot='XXXXXXXXXX'></ins>
  <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>

<div class='rail-ad rail-right'>
  <button type='button' class='rail-close' aria-label='Close ad' onclick='this.parentNode.style.display=&quot;none&quot;'>Close ad</button>
  <ins class='adsbygoogle' style='display:inline-block;width:120px;height:600px' data-ad-client='ca-pub-XXXXXXXXXXXXXXXX' data-ad-slot='XXXXXXXXXX'></ins>
  <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>
</b:if>code-box

How the code works

  • data:blog.isMobileRequest == false shows the ads only to desktop visitors.
  • data:blog.pageType == item limits them to individual post pages. Remove this condition if you want them on every page.
  • position: fixed keeps the ad in place while the page scrolls.
  • The @media rule hides the ads on screens narrower than 1300 pixels, so they never cover your text.
  • The close button lets visitors dismiss the ad, which improves user experience.

Note: your theme normally already loads the main AdSense script in the <head>. If not, add the AdSense adsbygoogle.js script there once. Do not add it twice.

How to Add Floating Sticky Sidebar Ads in WordPress

WordPress does not need theme code editing for this. The safest method is a small snippet in a Custom HTML block or a code-snippets plugin.

  1. Install a code-snippets plugin (or use a child theme) so your change survives theme updates.
  2. Add the CSS below to Appearance > Customize > Additional CSS.
  3. Add the HTML for the two ad units using the plugin's footer hook, or a Custom HTML widget placed in the footer area.
  4. Replace the publisher ID and slot IDs, save, and test on a desktop screen.
.rail-ad{position:fixed;top:90px;width:120px;height:600px;z-index:50} .rail-left{left:10px} .rail-right{right:10px} @media screen and (max-width:1300px){.rail-ad{display:none}}
<div class="rail-ad rail-left"> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-XXXXXXXXXXXXXXXX" data-ad-slot="XXXXXXXXXX"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script> </div>code-box

Repeat the block with the class rail-right for the right-hand ad. If you use Google Site Kit or a theme with built-in ad settings, check whether it already offers an anchor or side-rail option before adding code manually.

How to Customize the Ads

  • Change the position. Edit top:90px to move the ads higher or lower. Edit left:10px or right:10px to move them closer to or further from the edge.
  • Change the size. Update the width and height in three places: the .rail-ad CSS, the .rail-close width, and the inline style on the <ins> tag. The AdSense ad unit must also be created with the same size. If you only change the CSS, the ad will keep its old size.
  • Change when they appear. Raise or lower the 1300px value in the media query to match the width of your layout.
  • Show on one side only. Delete the left or the right block.

Best Practices: Staying Within Google's Guidelines

Sticky ads are allowed on many sites, but the way you place them matters. Follow these tips and always read the current Google AdSense program policies and placement guidelines before publishing.

  1. Never cover your main content. Hide the ads on narrow screens so they do not overlap text, buttons or navigation.
  2. Do not mislead visitors. The close button should be clearly labeled and should really close the ad. Never disguise ads as site features.
  3. Do not encourage clicks. Avoid phrases such as "click here" or any design that causes accidental clicks.
  4. Keep the ad count reasonable. Do not fill every edge of the page. Content should remain the main reason a visitor stays.
  5. Protect page experience. Reserve the exact ad space with fixed width and height so the page does not shift while ads load. Layout shifts affect Core Web Vitals.
  6. Keep the page fast. Lazy-load ads where possible and avoid loading unnecessary scripts.
  7. Follow the helpful-content principle. Google says content should be created for people first. A good article with a few well-placed ads is better than a page built mainly for ads.
  8. Test regularly. Check your layout on different screen sizes and use Google Search Console to monitor Core Web Vitals and page experience.

Common Problems and Quick Fixes

Problem

Likely cause

Fix

Ads do not show

Wrong publisher ID or slot ID, or the unit is new

Re-check both IDs and wait a few hours for the ad unit to activate

Ads show but look blank

No ad inventory or an ad blocker is on

Test in another browser without extensions

Ads overlap the content

Your layout is wider than the ads' margin space

Increase the media query width or reduce the ad width

Resizing does not work

Only the CSS was changed

Change the size in the CSS, the inline style and the AdSense ad unit

Ads appear on every page

Page-type condition was removed

Add back the pageType == item condition

Ads show on mobile

Mobile condition or media query is missing

Keep both the isMobileRequest check and the @media rule

Frequently Asked Questions

Are floating sticky sidebar ads allowed by Google AdSense?

Google supports fixed ad formats, and many sites run side rail units. Your placement still has to follow AdSense program policies, so make sure ads do not cover content, mislead users or cause accidental clicks.

Do sticky sidebar ads increase earnings?

They can improve viewability and impressions on desktop, which may raise revenue. The effect depends on your audience and layout, so test for a few weeks and compare your reports.

Will sticky ads slow down my website?

Any extra ad adds some load. Use fixed dimensions, avoid duplicate scripts and consider lazy loading to limit the impact.

Can I show sticky sidebar ads only on blog posts?

Yes. In Blogger, use the pageType == item condition. In WordPress, use a conditional tag such as is_single() in your snippet plugin.

Do sticky sidebar ads work on mobile?

Usually not. They need empty side space, so most setups hide them on screens under about 1300 pixels. Use anchor or in-content ads for mobile instead.

What is the best size for a sticky sidebar ad?

Tall formats such as 120x600 and 160x600 are common choices for side rails. Choose the size that fits the free margin on your layout.

Conclusion

Floating sticky sidebar ads are a simple way to keep your ads visible on desktop without adding pop-ups or covering your content. With a few lines of code you can add them to Blogger or WordPress, customize the size and position, and let visitors close them if they wish.

The key is balance. Use only the space that is truly empty, reserve ad space to protect speed, follow Google's guidelines, and measure your results. If the ads help your revenue without hurting your reader's experience, keep them. If not, adjust or remove them.

Found this guide useful? Share it with another blogger, and leave a comment if your layout needs a custom fix.

0/Post a Comment/Comments

Do not use spammy word.

Ads1

Ads2