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 or template changes are required.

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 or template changes required)
  • 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 14.3 LTS
  • PHP >= 8.2 (8.2–8.5)
  • 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.

No further setup required 

There is nothing more to configure. The consent banner is injected on the frontend by a PSR-14 event listener that is registered automatically when the extension is installed -- no TypoScript, site set, or Fluid template change is needed.

After installing the extension, clear all caches and open Web > Prive Consent to add your script (see Usage).

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 the site:

  • The consent script is injected before </body> by a PSR-14 event listener
  • A cookie settings button is also rendered, allowing visitors to re-open the consent dialog at any time

No site set, TypoScript, 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 sys_template record of the site root page.

On frontend rendering, the PSR-14 event listener InjectBannerScript (listening on AfterCacheableContentIsGeneratedEvent) calls DatabaseService->getBannerMarkup() and splices the resulting script and cookie settings button in before </body>. The markup is only produced when the enable flag is set, and it becomes part of the cacheable page content.

TYPO3 Backend               Frontend
     |                          |
     v                          |
ConsentController               |
     |                          |
     v                          v
DatabaseService ---- sys_template -----> InjectBannerScript (event listener)
  (save/load)        (storage)           (getBannerMarkup)
                                              |
                                              v
                                      inject 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 via the #[AsEventListener] attribute. 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.

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 -- and the markup becomes part of the cacheable page content.

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 automatically on all frontend pages by a PSR-14 event listener as soon as the extension is installed. No site set, TypoScript, or template changes are needed.

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.