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 via TypoScript.

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 via TypoScript page.footerData
  • Cache flush on save — frontend page cache is cleared automatically after saving

Requirements 

  • TYPO3 10.4 LTS
  • PHP >= 7.2
  • 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.

Include the static TypoScript 

After installation, include the static TypoScript template so the consent script and cookie button are rendered on the frontend:

  1. Open the Template module

    In the TYPO3 backend, go to the Template module.

  2. Select the root page

    Select the root page of your site.

  3. Edit the template record

    Choose Info/Modify and click Edit the whole template record.

  4. Include the static template

    Switch to the Includes tab and add [kroener.DIGITAL] Prive Consent from the list of available static templates.

  5. Clear caches

    Clear all caches to ensure the TypoScript is loaded.

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 where the static TypoScript template is included:

  • The consent script is injected into page.footerData (before </body>)
  • A cookie settings button is also rendered, allowing visitors to re-open the consent dialog at any time

No additional 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, a TypoScript USER object calls DatabaseService->renderBannerScript() to output the script and the cookie settings button in the page footer. The script is only rendered when the enable flag is set.

TYPO3 Backend               Frontend
     |                          |
     v                          |
ConsentController               |
     |                          |
     v                          |
DatabaseService ---- sys_template -----> TypoScript USER object
  (save/load)        (storage)           (renderBannerScript)
                                              |
                                              v
                                         page.footerData
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 minimal configuration. After including the static TypoScript template (see Installation), the consent script and cookie button are rendered automatically.

TypoScript setup 

The static TypoScript template [kroener.DIGITAL] Prive Consent configures:

  • lib.priveScript -- a USER object that calls DatabaseService->renderBannerScript() to output the consent script
  • page.footerData -- inserts the cookie button HTML and consent script before </body>
  • page.includeCSS -- loads the cookie button stylesheet

The footerData keys use crc32('ok_prive_cookie_consent') to avoid collisions with other extensions.

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. After including the static TypoScript template [kroener.DIGITAL] Prive Consent, the consent script and cookie button are rendered automatically on all frontend pages. No additional 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 Where to get help.

Contact 

Author 

Oliver Kroeneroliver-kroener.de

Oliver is a software engineer and consultant specializing in Power Automate, AI, Microsoft Azure, TYPO3, and cloud solutions.

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.

Sitemap