Paste the TermsFeed Privacy Consent snippet into the <head> of every page, load it from the address the TermsFeed app gives, and keep it out of Google Tag Manager. The snippet is a single <script> tag with the async attribute. It loads the consent banner, the Preferences Center, and your vendor settings from cdn.termsfeedtag.com.

The app gives this snippet, with the 32-character token of your consent banner in place of YOUR_TOKEN.

<!-- Privacy Consent by TermsFeed (https://www.termsfeed.com) -->
<script type="text/javascript" src="https://cdn.termsfeedtag.com/plugins/pc/v1/YOUR_TOKEN/plugin.js" async></script>
<!-- End Privacy Consent by TermsFeed (https://www.termsfeed.com) -->

The rules below hold on every platform. Find where the head code goes on Shopify, WordPress, Wix, Squarespace, Webflow, and other platforms with Install on Your Platform.

What you need before installing the script

You need edit access to the <head> of your templates, or to the head code field of your platform. List the tracking scripts on your website today, because each one moves into a vendor. Get the consent banner and its snippet from Create a Consent Banner.

Why the script goes in the head before any vendor code

The script goes in the <head> so that the browser starts downloading it as soon as a page begins to load. The async attribute lets the browser keep building the page while plugin.js downloads. The script then waits until the page is parsed, loads its other files, and reads your settings, which takes 7 requests in all.

Put the snippet before every other script in the head, once per page. A second copy of the snippet stops with [ee][205bde55] or [ee][1040992c] in the Console tab of DevTools, and the first copy runs normally.

The position of the snippet does not protect anything by itself, because Privacy Consent does not block a script that stays in the page. A Google Analytics, Meta Pixel, or Hotjar snippet in your template runs before consent and after a refusal. Move each one into a vendor and delete it from the page, following Add a Vendor From a Template.

Why the script loads from the address the TermsFeed app gives

Load plugin.js from the address in the snippet, because the script takes your token and its host from there. Every later file, settings request, and consent log event goes to that host. Keep the address and the async attribute exactly as the app gives them.

A copy of plugin.js that you serve from your own server stops receiving the updates TermsFeed makes to it. A renamed or bundled copy still fetches the rest from cdn.termsfeedtag.com, and only the copied file stays old.

A proxy that serves the file under the same path on your own domain sends every Privacy Consent request to your domain. That proxy must forward every path under /plugins/, /plugins-code/, /plugins-api/, and /plugins-api-w/ to cdn.termsfeedtag.com, and it must pass each Origin header through unchanged. A settings request without the right Origin fails, and the Console tab shows [ee][34c59001].

Add your Google tags from their templates in the TermsFeed app, and Google Consent Mode v2 needs no code in the head. Privacy Consent then sends the Consent Mode defaults before the Google tag loads, and an update at every answer. Remove any Consent Mode code you pasted into the head yourself, because 2 senders write to the same window.dataLayer, and the latest command applies.

Basic Consent Mode is different, because a custom vendor does not send consent signals and your own code sends them instead. Google tags read the default as they load, so the head of such a page follows this order.

  1. Put your Consent Mode default command first.
  2. Put any Google tag or Google Tag Manager container that stays in the page next.
  3. Put the Privacy Consent snippet last.

Your own code needs the default command and an update at every answer. Copy the complete Basic Consent Mode block from Set Up Google Consent Mode v2.

How to install the script on a hand-coded site

A hand-coded site is one where you edit the HTML files or page templates yourself. The install takes 5 steps and about 10 minutes.

Install screen of a consent banner in the TermsFeed app, with the install code and its Copy button, and the guides for Shopify, WordPress, Wix, Squarespace, and Webflow

  1. Open "Install" in the menu of the consent banner in the TermsFeed app and select "Copy".
  2. Open the template every page shares, such as a header include, or each HTML file of a site without one.
  3. Paste the snippet before </head>, ahead of every other script except your own Consent Mode code.
  4. Delete each tracking script from the page once you have added it as a vendor.
  5. Publish the change, open the page in a private window, select the Network tab of DevTools, and filter for termsfeedtag. The plugin.js request shows status 200.

A website with a Content Security Policy needs https://cdn.termsfeedtag.com in script-src and connect-src, and inline styles allowed in style-src. Add those entries with Content Security Policy, and follow the longer walkthrough in Hand-Coded Site.

Paste the Privacy Consent snippet into the page itself, never into a Google Tag Manager tag. Google Tag Manager runs a tag only after its container downloads, so the consent banner appears later and your vendors wait longer. A container you hold back as a vendor never loads a consent banner placed inside it. An ad blocker that stops Google Tag Manager stops the consent banner too.

Google Tag Manager stays useful beside Privacy Consent for the tags that wait for consent. Choose how to connect them in Use Google Tag Manager.

The script stops on a page whose address has no hostname, prints [ee] lines in the Console tab, and does not show a consent banner. A page opened from disk with a file:/// address prints [ee][36de8955] and [ee][e0498738]. A frame with no address of its own, such as about:blank or a srcdoc frame, stops in the same way.

A page inside an iframe that has its own https:// address loads Privacy Consent normally. The script loads on localhost, *.localhost, *.local, 127.0.*.*, and *.example.com without any setup, so a local test needs no extra entry. Check the alternatives for Shopify checkout, native apps, and platforms with no head access in Unsupported Environments.

Run this check in Chrome after every install. A private window makes sure that no saved answer and no cached file hides a request.

  1. Open your website in a private window, open DevTools, and select the Network tab.
  2. Tick "Disable cache", type termsfeedtag in the filter box, and reload the page.
  3. Confirm 7 requests with status 200: plugin.js, plugin-2.js, plugin-r2.js, preferences-r2.js, vendors-r2.js, and settings.json twice. The events.push requests beside them return 201 and report the page view.
  4. Select the Console tab and type termsfeed in the filter box. A healthy load prints nothing, so a line with [ee] or [ww] points to a problem.

A new consent banner then appears in the bottom left corner of the page. Run the checks for blocking and the consent log with Check That Your TermsFeed Privacy Consent Installation Works.