Introduction 

What does it do? 

The Prive Consent extension provides a TYPO3 backend module for managing Prive Cookie Consent banner scripts. Administrators can edit, enable, and deploy consent scripts directly from the TYPO3 backend without needing file system access or a deployment pipeline.

The consent script and a floating cookie settings button are rendered automatically on all frontend pages by a PSR-14 event listener -- no TypoScript and no site set have to be configured.

Features 

  • Backend module under Web > Prive Consent for editing consent scripts
  • Enable/disable toggle to activate or deactivate the banner without removing the script
  • Multi-site support -- automatically resolves the correct site root per TYPO3 site configuration
  • Unsaved changes protection -- warns before navigating away with unsaved modifications, with a "save and close" option
  • Automatic frontend rendering -- script and cookie settings button injected before </body> by a PSR-14 event listener, no TypoScript required
  • Site set (TYPO3 13.1+) -- selectable under Site Management > Sites; optional, the banner works without it
  • Cache flush on save -- frontend page cache is cleared automatically after saving
  • Cookie settings button -- fixed-position floating button with SVG cookie icon allowing visitors to reopen the consent dialog at any time

Requirements 

  • TYPO3 12.4 LTS or 13.4 LTS
  • PHP >= 8.1
  • A Prive account to obtain the consent JavaScript snippet

Installation 

Install with Composer 

Install the extension via Composer:

composer req oliverkroener/ok-prive-consent
Copied!

See also Installing extensions.

Install via Extension Manager 

Download or upload the extension and activate it via Admin Tools > Extensions.

After the installation 

No TypoScript needs to be included and no site set needs to be added -- the consent script and cookie button are injected by a PSR-14 event listener that is registered through the extension's Services.yaml.

  1. Update the database

    Go to Admin Tools > Maintenance > Analyze Database Structure and apply the suggested changes. This adds the two consent fields to the pages table.

  2. Clear caches

    Clear all caches so the event listener is picked up.

  3. Optional: add the site set (TYPO3 13.1+)

    In Site Management > Sites you may add the set [kroener.DIGITAL] Prive Consent. The set is empty and optional -- see Site set.

Upgrading from version 4.1.1 or older 

Up to version 4.1.1 the banner settings were stored on the sys_template record of the site root. Since version 4.2.0 they live on the pages record of the site root, so that sites driven purely by site sets -- which have no sys_template record at all -- keep working.

  1. Analyze the database structure

    Admin Tools > Maintenance > Analyze Database Structure.

  2. Run the upgrade wizard

    In Admin Tools > Upgrade > Upgrade Wizard, run EXT:ok_prive_consent: Move consent banner settings from sys_template to pages. It copies the existing script and enable flag to the site root page. Running it twice is harmless.

  3. Optional: clean up the TypoScript record

    The static template [kroener.DIGITAL] Prive Consent is empty now. It is still shipped so existing includes do not break, but it can be removed from the Includes tab of your template record.

Usage 

This extension provides a dedicated TYPO3 backend module for managing the Prive Cookie Consent banner script. Administrators can edit, enable, and deploy the consent script without needing file system access or a deployment pipeline.

Using the backend module 

  1. Open the module

    In the TYPO3 backend, navigate to Web > Prive Consent.

  2. Select a page in the page tree

    Click on any page that belongs to the site you want to configure. The module automatically resolves the site root page from the TYPO3 Site Configuration.

    The module displays the detected site identifier and root page ID.

  3. Toggle the consent banner

    Use the Enable Prive script toggle to activate or deactivate the consent banner. When disabled, no script is rendered on the frontend, but the saved script is preserved.

  4. Edit the script

    Paste the JavaScript snippet provided by Prive into the script editor field. The editor uses a monospace textarea for editing JavaScript code.

  5. Save

    Click the Save button to persist the script. A success message confirms the script has been saved.

Unsaved changes protection 

The module detects unsaved changes and warns before navigating away. If you modify the script or toggle the enable switch without saving, a confirmation dialog appears when you attempt to leave the page.

The dialog offers three options:

  • No, I will continue editing — stay on the page and keep editing
  • Yes, discard my changes — leave the page without saving
  • Save and close — save the current changes via AJAX and then navigate away

Frontend rendering 

Once a script is saved and enabled, it is automatically rendered on every frontend page of that site:

  • The consent script is injected immediately before the closing </body> tag
  • A cookie settings button is also rendered, allowing visitors to re-open the consent dialog at any time

No TypoScript, site set or Fluid template changes are required.

How it works 

The extension stores the consent script and an enable flag in custom fields (tx_ok_prive_cookie_consent_banner_script and tx_ok_prive_cookie_consent_banner_enabled) on the pages record of the site root page.

On frontend rendering, the PSR-14 event listener InjectBannerScript reacts to AfterCacheableContentIsGeneratedEvent, asks DatabaseService->getBannerMarkup() for the markup and splices it in before </body>. Nothing is rendered when the enable flag is unset or the script is empty.

TYPO3 Backend               Frontend
     |                          |
     v                          v
ConsentController          InjectBannerScript
     |                          |  (AfterCacheableContentIsGeneratedEvent)
     |                          v
     |                     DatabaseService
     |                          |  (getBannerMarkup)
     v                          v
    pages record  <---------  pages record
  (site root, storage)      (site root, storage)
                                |
                                v
                         markup before </body>
Copied!

Multi-site support 

In a TYPO3 multi-site setup, the extension uses SiteFinder to resolve the correct site root page for the currently selected page in the page tree. Each site can have its own independent consent script and enable/disable state.

Configuration 

The extension requires no configuration. Once it is installed, the consent script and cookie button are rendered automatically on every frontend page.

Frontend rendering 

Rendering is handled by the PSR-14 event listener OliverKroener\OkPriveConsent\EventListener\InjectBannerScript, registered through the extension's Services.yaml with the event.listener service tag. It listens on \TYPO3\CMS\Frontend\Event\AfterCacheableContentIsGeneratedEvent and splices the cookie button CSS, cookie button HTML, and consent script in before the closing </body> tag. The markup is added while the content is still cacheable, so it becomes part of the page cache.

There is no TypoScript, site set, or Fluid template to configure. Injecting via an event listener keeps rendering independent of site-set load order -- a theme set re-declaring page = PAGE can no longer discard the banner.

Static TypoScript template 

The static template [kroener.DIGITAL] Prive Consent still exists, but it is empty since version 4.2.0. Up to version 4.1.1 it defined lib.priveScript and a page.footerData entry; both were removed when rendering moved into PHP.

It is only kept so that TypoScript records which already include it do not end up with a dangling reference. Including it is optional and has no effect, and it can safely be removed from your template record.

Site set 

The extension ships a site set in Configuration/Sets/OkPriveConsent/:

EXT:ok_prive_consent/Configuration/Sets/OkPriveConsent/config.yaml
name: oliverkroener/ok-prive-consent
label: '[kroener.DIGITAL] Prive Consent'
dependencies: []
Copied!

On TYPO3 13 it is listed in the backend under Site Management > Sites as [kroener.DIGITAL] Prive Consent.

config/sites/<identifier>/config.yaml -- the set reference is optional
rootPageId: 1
base: 'https://example.org/'
dependencies:
  - oliverkroener/ok-prive-consent
Copied!

See site sets in the TYPO3 Core API reference for general information on site sets.

Prive account 

The JavaScript snippet that powers the consent banner is provided by Prive. You need a Prive account to obtain the script. Paste the script into the backend module (see Usage).

Refer to the Prive documentation for configuring which cookies are managed, consent categories, banner appearance, and language settings.

Frequently Asked Questions (FAQ) 

See chapter Installation.

You need a Prive account. After configuring your consent banner in the Prive dashboard, copy the JavaScript snippet and paste it into the TYPO3 backend module at Web > Prive Consent.

Navigate to Web > Prive Consent in the TYPO3 backend. Select a page in the page tree -- the module automatically resolves the site root. From there you can edit the script, enable or disable the consent banner, and save.

See chapter Usage.

No. The consent script and cookie button are injected before the closing </body> tag by a PSR-14 event listener that ships with the extension. Nothing has to be included, configured or overridden.

The static TypoScript template [kroener.DIGITAL] Prive Consent is empty since version 4.2.0 and only kept so existing includes do not break.

No. The set oliverkroener/ok-prive-consent is empty -- it defines no TypoScript, no dependencies and no settings. Adding or removing it makes no difference to the frontend output.

See chapter Site set.

No. Site sets were introduced in TYPO3 13.1. On TYPO3 12 the Configuration/Sets/ directory of this extension is ignored by the core. The banner is rendered by the event listener on both TYPO3 12 and 13, so nothing is missing on TYPO3 12.

The settings moved from the sys_template record to the site root's pages record. Run the database analyser, then the upgrade wizard EXT:ok_prive_consent: Move consent banner settings from sys_template to pages in Admin Tools > Upgrade.

See chapter Upgrading from version 4.1.1 or older.

Yes. In a TYPO3 multi-site setup, the backend module resolves the correct site root page automatically. Each site can have its own independent consent script and enable/disable state.

In the backend module, uncheck the Enable Prive script toggle and click Save. The saved script is preserved but no longer rendered on the frontend. Re-enable it at any time by checking the toggle again.

Yes. The button is styled via Resources/Public/Css/prive-cookie-button.css. You can override these styles with custom CSS in your site package.

See chapter Cookie button styling.

See chapter Contact.

Contact 

Author — Oliver Kroener 

Automated. Scaled. Done. 

Web3 · Cloud · Automation

Technology is only valuable when it solves a real problem. For over 30 years I've been translating between business and tech — so your investment in digitalisation doesn't stall at proof-of-concept but delivers measurable results.

Support 

If you encounter issues or have questions about this extension:

Contributing 

Contributions are welcome. Please open a pull request or issue on GitHub.

License 

This extension is licensed under the GPL-2.0-or-later.