Skip to main content
Cookbook Content Cookiebot

Add a Cookie Declaration Page with Cookiebot and AI

A draft page with Cookiebot's Cookie Declaration block and your intro, checked and ready for you to publish.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running Cookiebot by Usercentrics 4.7 or newer (tested on 4.8.1, free) on WordPress 6.9 or newer, with an administrator account, and a Cookiebot or Usercentrics account for the banner itself. Pages made in the block editor, and a Cookiebot Domain Group ID (not a Usercentrics Settings ID).

The prompt
My WordPress site uses the Cookiebot by Usercentrics plugin and the block editor. Make a cookie declaration page, as a draft.

1. Run discover_abilities with category cookiebot. If the cookiebot abilities this needs are not there, stop and tell me to install or update the free Cookiebot by Usercentrics plugin from WordPress.org (4.7 or newer, on WordPress 6.9 or newer).
2. Run cookiebot/get-status. If cbid_set is false, stop and tell me to connect my Cookiebot ID first. Then run run_wp_cli with option get cookiebot-cbid. If option get comes back empty or not found while cbid_set is true, the ID is set for the whole multisite network: read it from the banner script on my home page (get_page_html, url set to my home page's address) and tell me it is set network-wide. If the ID is 36 characters with any capital letters, stop and tell me to save it again in lowercase first: the plugin loads the Usercentrics banner for it. If it is not a Cookiebot Domain Group ID (36 characters: letters a to f and digits in groups of 8, 4, 4, 4 and 12, joined by dashes), stop and tell me the declaration block loads from Cookiebot with a Domain Group ID, so it is not for a Usercentrics Settings ID.
3. Look for a declaration I already have: run rest_api GET /wp/v2/pages?search=cookiebot/cookie-declaration&status=any&_fields=id,title,status,link, then the same with search=cookie_declaration and with search=CookieDeclaration, and the same three searches on /wp/v2/posts. If any finds a page, tell me its title, status and link, and stop.
4. Create the page with rest_api_write POST /wp/v2/pages: status draft, title [Cookie Declaration], and content made of a paragraph block with [one or two sentences to introduce the list, for example: This page lists the cookies this site uses and lets you change your consent.], followed by Cookiebot's Cookie Declaration block: a self-closing block named cookiebot/cookie-declaration, with no attributes. Don't publish it.
5. Run rest_api GET /wp/v2/pages/PAGE_ID?context=edit&_fields=content and check content.rendered has a script with id CookieDeclaration loading cd.js from consent.cookiebot.com for my ID. If it says Please add your Cookiebot ID to show Cookie Declarations instead, tell me the ID is not set.
6. Give me the draft's edit link. Tell me to open its preview to see the list (it loads from Cookiebot in the browser), to publish it when it looks right, and to link it from my privacy policy or footer.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Add a Cookie Declaration Page with Cookiebot and AI” recipe from the WPVibe cookbook on my connected site.

A cookie banner asks for consent, and many privacy policies also point to a page that lists the cookies your site sets. Written by hand, that list falls behind every new plugin or tag.

Cookiebot’s Cookie Declaration block loads that list from your Cookiebot account. The AI checks your Cookiebot ID is connected, makes sure you don’t already have the page, and creates a draft page with your intro and the block. It checks the draft carries Cookiebot’s declaration script for your ID, and leaves publishing to you.

The block loads from Cookiebot with a Cookiebot Domain Group ID, so the recipe stops for a Usercentrics Settings ID. The list itself loads in the visitor’s browser, so open the draft’s preview to see it. This recipe is for pages made in the block editor. After you publish, link the page from your privacy policy or footer.

Outcome

A draft cookie declaration page with Cookiebot's block for your ID, and its edit link.