Turn on the Cookie Consent kit in TermsFeed AutoTerms and add each tracking script as a vendor script, so that under the default GDPR preference it waits for consent. The kit loads TermsFeed Free Cookie Consent 4.2.0 from www.termsfeed.com, and the Cookie Consent script releases each vendor script when its category is allowed to run. Setup takes 6 steps and about 15 minutes.

Sign in as an Administrator who holds the WordPress unfiltered_html capability, or as a user with a plugin role and that capability. Copy the tracking code of each tool you use, such as the Google tag of Google Analytics 4. Then remove that code from your WordPress theme and other plugins, because the kit holds back only the scripts in its own list.

Open TermsFeed > Compliance Kits in your WordPress admin and click the "Configure" button in the Cookie Consent box. The "Customization" tab opens, followed by "Vendor Scripts" and "Configuration Parameters".

The Cookie Consent box on the Compliance Kits screen with the status Disabled and the Enable and Configure buttons marked

Tick "Enabled" at the top of the Customization tab and click the "Save Changes" button, or click the "Enable" button in the Cookie Consent box, which saves at once. The consent banner appears on every page once your page cache is cleared, to logged-in users too.

Step 3: Check the Compliance preference

Keep "Compliance preference" on "GDPR Directive (i.e. I Agree & I Decline buttons)", the default, for any site with visitors from the EU, the UK, or Switzerland. With the default page_load_consent_levels, only strictly-necessary vendor scripts then run before the visitor accepts a category. "ePrivacy Directive (i.e. OK button)" by default runs the vendor scripts of all 4 categories on every page load until the visitor turns a category off.

Keep the Customization defaults or change the fields you need, then click the "Save Changes" button.

  • "Website name" holds the WordPress Site Title by default.
  • "Notice banner style" sets the layout, "Headline" by default.
  • "Color palette" sets "Light", the default, or "Dark".
  • "Default language" sets 1 of 36 languages, English by default, for the consent banner and the Preferences Center.
  • "Insert link for users to open Preferences Center" prints an "Update cookies preferences" link at the end of every page. Untick it only after you add your own element with the id open_preferences_center.

The Preview on the right of the tab redraws the consent banner as you change the name, style, palette, and language. Look up every value and default in Customize the WordPress Cookie Banner.

The Customization tab of the Cookie Consent kit with the Compliance preference marked, the name, style, palette, and language fields, and the Preview of the consent banner

Step 5: Add each tracking script as a vendor script

  1. Open the "Vendor Scripts" tab.
  2. Type a Name, choose a Type, and paste the vendor code into the "Script" field.
  3. Click the "Add vendor script" button.
  4. Click the "Save Changes" button.

Google Analytics 4 takes the Type "Tracking and Performance (i.e. Google Analytics)", and an advertising pixel takes "Targeting and Advertising (i.e. Google AdSense, Google AdWords)". Follow the rules for pasted code in Block WordPress Scripts Until Consent.

The checks assume the default GDPR preference with page_load_consent_levels at ["strictly-necessary"]. The Preview on the Customization tab shows only the look of the consent banner and does not keep an answer, so check the live site.

  1. Clear your page cache.
  2. Close every private window, open a new one, open Chrome DevTools, select the Network tab, and type cookie-consent.js in the filter box. Load any page and confirm a request to www.termsfeed.com with status 200 and the consent banner on screen.
  3. Change the filter to the host a vendor script loads from, such as googletagmanager.com for Google Analytics 4. Confirm that no request appears before you answer, unless the vendor script is "Strictly Necessary".
  4. Click the "I agree" button and confirm that the vendor request appears with status 200.
  5. Select the Application tab, open Cookies and your domain, type cookie_consent in the filter box, and confirm the consent cookies. Read what each one holds in Consent Cookie Storage and Duration in Free Cookie Consent.
  6. Close every private window, open a new one, and open Chrome DevTools on the Network tab filtered on the vendor host. Load the page, click the "I decline" button, and confirm that no vendor request appears.

The kit now holds back each optional vendor script until the visitor accepts its category, under the default GDPR preference. Find the cause of a consent banner that never shows in WordPress Cookie Banner Not Appearing.

Open the Preferences Center from a WordPress menu item

A WordPress menu item has no field for an id, so it opens the Preferences Center through a class and the open_preferences_center_selector option of Cookie Consent.

  1. In a classic theme, open Appearance > Menus, open Screen Options at the top of the screen, and tick CSS Classes. In a block theme, open Appearance > Editor and select the Navigation block that holds the menu item.
  2. Open the menu item, type open-cookie-preferences in CSS Classes (optional), and click Save Menu. In a block theme, type it in Advanced > Additional CSS class(es) of the link, then save.
  3. Open the "Configuration Parameters" tab of the Cookie Consent kit, add "open_preferences_center_selector": "#open_preferences_center, .open-cookie-preferences", as a new line after the opening { of the JSON, and click the "Save Changes" button.
  4. Clear your page cache.
  5. Close every private window, load a page of your WordPress website in a new one, click the menu item, and confirm that the Preferences Center opens.