Choose how to block each script, embed, and stylesheet on your site
TermsFeed Privacy Consent (CMP) blocks third-party content only when you hand it over: move the code into a vendor tag, or rewrite the element as a replaceable tag. Until the visitor accepts the vendor, the browser does not request that content, so the vendor does not set a cookie or see the visitor IP address. The factor that decides between the 2 methods is whether the content has to stay at its place in your page.
Privacy Consent does not scan your pages, and it does not rewrite code it did not insert. A snippet left in your templates, or one a plugin prints, loads for every visitor. The ePrivacy Directive and the General Data Protection Regulation (GDPR) ask for consent before non-essential cookies and tracking run, so give every non-essential service one of the 2 methods.
Method 1: Move the code snippet as a vendor tag
Cut the snippet from your page and let Privacy Consent CMP insert it, either from a template or from your own code. A vendor tag is the code slot of a vendor in Privacy Consent, in one of 4 types: JavaScript, HTML, Style, or Link. JavaScript, Style, and Link vendor tags go into <head>, and HTML vendor tags go inside a <div> whose id is the vendor ID.
Method 1 suits code that does not need a place of its own in your templates, such as analytics scripts, advertising pixels, chat widgets, and web font stylesheets. A template writes the vendor tag from an ID, so start with Add a Vendor From a Template. Remove every copy of the snippet from your page afterward.
Method 2: Swap the element for a replaceable tag
Rename an element in your page to its Privacy Consent replaceable tag and add the vendor ID, and Privacy Consent creates the real element once the visitor accepts. A replaceable tag is a stand-in element that loads nothing, such as <termsfeed-privacy-consent-tag-iframe> in place of <iframe>. Replaceable tags exist for 5 elements: iframe, img, script, style, and link. The vendor needs "Has replaceable tags?" turned on in Privacy Consents > Vendors page.
Here is a YouTube embed before and after the swap, with a vendor ID in the form the "Important tags" button shows.
<!-- Before: loads for every visitor -->
<iframe src="https://www.youtube-nocookie.com/embed/VIDEO_ID" width="560" height="315" title="Product tour" allowfullscreen></iframe>
<!-- After: loads once the visitor accepts the vendor -->
<termsfeed-privacy-consent-tag-iframe data-termsfeed-pc1-vendor-id="termsfeed-1a2b3c4d-5e6f" src="https://www.youtube-nocookie.com/embed/VIDEO_ID" width="560" height="315" title="Product tour" allowfullscreen></termsfeed-privacy-consent-tag-iframe>
Method 2 suits content that has to appear at its own place, such as a video in an article. Follow the steps in Replaceable Tags.
Which content shows an embed placeholder until consent
A replaceable iframe or image shows the embed placeholder at its place until the visitor accepts, and so does the <div> of a vendor with on-accept HTML. The embed placeholder names the vendor, links its privacy policy, and offers the answer buttons. Accepting there loads the content in place, with no page reload.
Replaceable script, style, and link elements show nothing before consent, because they have no visible content. Fit the embed placeholder to your design with Style the TermsFeed Privacy Consent Embed Placeholder.
Which method to pick for each kind of content
Use a vendor tag for code that leaves your templates entirely, and a replaceable tag for an element that has to stay in them. The factor in each row is whether visitors see the content at a fixed place.
| Content | Method | Why |
|---|---|---|
| A script snippet from a vendor | Template, or a JavaScript vendor tag on accept | Nothing has to stay in the page |
A <script> element in a template you control |
Replaceable script element |
The real script runs next to the replaceable tag, and it keeps its attributes |
| An iframe embed (YouTube, Google Maps, Spotify) | Template with a replaceable iframe element |
The embed placeholder and then the embed appear at the place of the iframe |
| A visible image from a vendor host | Replaceable img element |
The embed placeholder and then the image appear at the place of the image |
| A 1-pixel tracking image | JavaScript vendor tag on accept | A replaceable image shows a full embed placeholder for an invisible pixel |
A stylesheet <link> (Google Fonts, widget CSS) |
Link vendor tag on accept, or a replaceable link element |
The browser requests the file only after consent |
An inline <style> block for a vendor widget |
Style vendor tag on accept | The styles arrive with the widget they belong to |
Check either method in a new private window. Open Chrome DevTools, select the Network tab, filter for the vendor host, such as youtube, and load the page. No request to the host appears until you click I Agree or Accept this vendor, except with the Google Analytics 4, Google Ads, and Google Tag Manager templates.