All Collections
Mediavine Ads
Customizing your ad experience
How to manually block ads in your content with <div></div>
How to manually block ads in your content with <div></div>

Tell the Mediavine script wrapper where NOT to place an in-content ad unit.

Heather Tullos avatar
Written by Heather Tullos
Updated over a week ago

The Mediavine script wrapper looks at your site content to find the best placements for your ads for each user. It always makes sure two in-content ads will not appear on the screen at the same time. 

It also takes into account the size of a desktop user's window or device screen to help it determine where to insert the in-content ads. 

Our script wrapper is very, very smart, but it can't exactly read your content the way a human can! 

For example, if you wrote two paragraphs that make more sense when they appear together, you'd probably prefer that an ad didn't park itself between them! 

If we want to tell the script wrapper NOT to place an ad somewhere, we've got to put up a proverbial "KEEP OUT — NO ADS ALLOWED" sign using HTML. 

To do that, you can insert <div> and </div> around the content you want to keep together, and the script wrapper will not place an ad between those markers.  

Open your post HTML editor, and type <div> before the content you'd like to keep together, and place </div> at the end of it. Like this: 

<div>Our script wrapper is very, very smart, but it can't exactly 
<i>read</i> your content the way a human can!

For example, if you wrote two paragraphs that make more sense when
they appear together, you'd probably prefer that an ad didn't park
itself between them! </div>

Don't forget to save your changes! 

What if I'm using Gutenberg?

With Gutenberg, it has a block type called Group that will automatically nest its content inside a div. You can add a Group block and then either drag content into the Group block or paste content into it. Alternatively, you can convert a normal block into a Group block by clicking on the block option and selecting Group:

The <div> method is great for blocking ads from appearing in a small area of content, but it is not intended for blocking in-content ads on an entire page. Please follow these instructions to disable ads on single pages.

Please contact us at publishers@mediavine.com or by using the blue chat bubble in the bottom right of your screen with any questions, or if you need any help. 

Did this answer your question?