Integrations
JJoomla
implementation guidePlatforms and stores

Cookie banner for Joomla with Google Consent Mode v2

Add the CookiePilot banner to a Joomla 4 or 5 site through a child template. The code goes at the start of head in index.php, before the template's styles and scripts, and survives Joomla updates. Joomla core has no cookie banner of its own.

Consent behaviour

You paste the code into the child template's index.php, right after the metadata and before the template's styles and scripts.

Joomla updates do not overwrite a child template, so the code stays in place.

The stub sets Consent Mode v2 to denied before GA4, GTM and tags that extensions add through Joomla's standard assets load.

Setup steps

In the CookiePilot panel, add the site's domain and copy the install code.

In Joomla's administrator, open System → Site Templates → Cassiopeia Details and Files and click Create Child Template.

In the child template, create index.php as a copy of Cassiopeia's index.php and paste the CookiePilot code right after <jdoc:include type="metas" />, before <jdoc:include type="styles" /> and <jdoc:include type="scripts" />.

In System → Site Template Styles, make the child template's style the default.

If you use another template, paste the code the same way at the start of head in its index.php, ideally in a child template too.

Put manually pasted GA4 or GTM code below CookiePilot. If an extension adds the tags, check in the page source that they load after stub.js.

Open the site in a private window and check it using the checklist.

Platform limitations

Do not add the code through the template's user.js. That file loads after the template's assets, too late for the stub to run before tags.

Extensions that rewrite head after the page is rendered can insert their scripts above CookiePilot. You will see this in the page source.

Editing Cassiopeia's own index.php also works, but a Joomla update can overwrite it. Child templates are available from Joomla 4.1.

Joomla's “System - Privacy Consent” plugin covers privacy policy consent in forms, not cookies. It does not replace a banner.

Example snippet

Example snippet
<head>
  <jdoc:include type="metas" />
  <script src="https://cdn.cookiepilot.io/stub.js"></script>
  <script async src="https://cdn.cookiepilot.io/cookiepilot.js" data-cpkey="YOUR_SITE_KEY"></script>
  <jdoc:include type="styles" />
  <jdoc:include type="scripts" />
</head>

Test checklist

In the page source, stub.js is in head before the template's CSS files and scripts.

The first dataLayer entry is consent default with denied values.

Before the visitor clicks there are no _ga, _gcl or _fbp cookies.

After Accept, dataLayer contains consent update granted.

After a Joomla update the code is still in the page source.

Related integrations

See the setups that most often appear together with this integration.

Ready to configure it?

Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.