Stop blocked embeds and ad slots from moving your page content
Reserve space in your own CSS for every embed, ad slot, and vendor container that TermsFeed Privacy Consent holds until consent. Cumulative Layout Shift (CLS) counts each time visible content moves without a click from the visitor. Privacy Consent starts after your page has parsed, so anything it inserts into the page flow moves the content below it. The fix takes 4 steps and about 15 minutes per page template.
Why the consent banner itself causes no layout shift
The Privacy Consent banner sits in a fixed position at the bottom of the viewport, outside the document flow, so it moves nothing. The Preferences Center covers the viewport in a fixed position, and the floating button stays fixed in a corner, so neither moves content either.
Keep that position in your CSS. A rule that sets the consent banner to position: static or relative puts it into the page flow, and the content around it then moves when it appears. Style the consent banner with Custom CSS.
What moves your page on a Privacy Consent site
Each of these appears or changes size after Privacy Consent loads, so check each on the templates that carry it.
- Embed placeholders. Privacy Consent adds an embed placeholder right after each
iframeorimgreplaceable tag. It takes its height from the element around it, with padding of its own, and it does not copy a width or height from the replaceable tag. - Embeds that load after consent. The real element appears next to the embed placeholder, which hides, so a difference in height moves the content under them.
- HTML vendor tags. Privacy Consent inserts them into the
<div>whoseidequals the vendor ID, which stays empty until then. - Ad slots. A slot stays empty for a visitor who declines and fills with an ad for a visitor who accepts.
An on-load transient HTML vendor tag adds markup on page load and removes it once an answer exists, so give its container a fixed height too.
Step 1: Find the shifts with Chrome DevTools
Open your site in a private window, open Chrome DevTools, press Ctrl+Shift+P (Cmd+Shift+P on macOS), type Rendering, and open the Rendering tab. Tick "Layout shift regions" and reload, and Chrome highlights each area that moves. Repeat after clicking I Agree, then reload once more as a returning visitor, so you see the embed placeholder, the embed after the click, and the embed on page load.
Step 2: Reserve the space in your stylesheet
Wrap each replaceable tag in a container with a minimum height, and give ad slots and vendor containers the same rule. Set the minimum height to the taller of the embed placeholder and the embed, measured at the narrowest width your site supports. Privacy Consent copies every other attribute of the replaceable tag onto the real iframe, so width and height attributes reach the embed.
This markup holds a video embed for a Functionality vendor.
<div class="tf-embed-slot">
<termsfeed-privacy-consent-tag-iframe
data-termsfeed-pc1-vendor-id="termsfeed-1a2b3c4d-5e6f"
src="https://www.youtube.com/embed/VIDEO_ID"
width="560" height="315" title="Product demo video"
allowfullscreen></termsfeed-privacy-consent-tag-iframe>
</div>
These rules cover the embed slot, a 300 by 250 ad slot, and the container of an HTML vendor tag. Put them in the stylesheet your page loads in the head, so the space exists from the first paint.
.tf-embed-slot {
min-height: 315px;
}
.tf-embed-slot iframe {
display: block;
max-width: 100%;
}
.ad-slot {
min-height: 250px;
}
#termsfeed-1a2b3c4d-5e6f {
min-height: 400px;
}
Each rule targets markup you own, so it applies whatever the answer. The minimum height holds the space for a visitor who declines and for one who accepts. Swap an element for a replaceable tag with Replaceable Tags.
Step 3: Use an on-load permanent vendor tag without stylesheet access
Paste the same CSS into an on-load permanent Style vendor tag where a platform gives you no access to your stylesheet. Open the vendor in the TermsFeed app, select the "Style tags" tab, switch on "On load (permanent)", and paste the rules inside a <style> element. Privacy Consent inserts this slot into the head on every page view, whatever the answer.
<style>
.tf-embed-slot { min-height: 315px; }
.ad-slot { min-height: 250px; }
</style>
The vendor tag applies only once Privacy Consent has loaded, so content that painted earlier moves once. Prefer the stylesheet from step 2 where you have it. Check where each vendor tag goes in Vendor Tag Matrix.
Step 4: Measure the layout shift result
Save your CSS or vendor change first. Close every private window between answers, because private windows share storage while any of them stays open.
- Open Chrome DevTools, select the Network tab, and type
settings.jsonin the filter box. Reload, and 2settings.jsonrequests appear, which shows that Privacy Consent loaded during the test. - Select the Performance tab, click the reload button to record, and open the Layout shifts track. No shift points at an embed slot, an ad slot, or a vendor container.
- Click I Agree and record again. The embed appears inside its reserved space, and the CLS value in the live metrics view stays at or below 0.1.
- Close every private window, open a new one, click I Decline, and record once more. The embed placeholder and the empty ad slot keep their reserved height.
A CLS of 0.1 or less counts as good in Core Web Vitals. Compare the result with your baseline in Core Web Vitals.