How to Add Cookie Banner on Joomla Website

If you’re running a Joomla website that uses cookies or tracking scripts (like Google Analytics, Google Search Console, etc.), GDPR compliance is essential. With Consentise, you can add a privacy-compliant cookie banner easily, without needing third-party Joomla extensions.

This guide will walk you through the steps to integrate Consentise cookie scripts directly into your Joomla site.

  1. Visit the Consentise Generate Script page.
  2. Enter:
    • Your website domain (e.g., www.example.com)
    • Privacy Policy URL (e.g., https://www.example.com/privacy-policy)
    • Default Language (e.g., en, fr, de, etc.)
  3. Click Generate Script to receive two code snippets:
    • A Mandatory Script for the <head> section.
    • A Consent Banner Script for the <body> section.

Step 2: Add the Mandatory Script in the <head>

To ensure no cookies are set before consent, place this script in the head section of your Joomla site.

Edit Joomla Template Files

  1. In your Joomla Admin panel, go to: SystemSite Template Styles → click your active template → Template Files.
  2. Open the index.php file of your template.
  3. Locate the <head> tag and insert the Mandatory Script just before any analytics or tracking code, ideally before the closing </head> tag:
<script>
// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('set', 'url_passthrough', true);
gtag('set', 'ads_data_redaction', true);
gtag('consent', 'default', {
  'ad_storage': 'denied',
  'ad_user_data': 'denied',
  'ad_personalization': 'denied',
  'analytics_storage': 'denied'
});
// UET default settings
window.uetq = window.uetq || [];
window.uetq.push('consent', 'default', {
  'ad_storage': 'denied'
});
</script>
  1. Still in the same index.php file, scroll down and locate the </body> tag.
  2. Paste the Consent Banner Script just before the closing </body> tag:
<script src="https://www.consentise.com/v1.2/consent-min.js" 
data-cookiedomain="www.website.com" 
data-privacy-policy-url="https://www.website.com/privacy-policy" 
data-preferred-color="#4fa5d3"
data-banner-position="bottom"
data-default-language="en"
defer>
</script>

Replace www.website.com and the policy URL with your actual site information.

Step 4: Save & Test the Banner

After saving changes:

  • Open your site in an incognito/private window.

  • Confirm:

  1. The cookie banner appears.
  2. No tracking scripts are triggered before the user gives consent.
  3. User choices are remembered on reload.

You can use browser developer tools or extensions like Tag Assistant to verify correct behavior.

Optional: Use a Custom Module (Alternative Method)

If you don’t want to modify template files:

  1. Go to Content → Site Modules → New.
  2. Choose Custom module.
  3. Set the Position to debug or footer.
  4. In the Editor, switch to Code view and paste the Consent Banner Script.
  5. Save and publish the module.

To insert the Mandatory Script, repeat the same steps but assign it to a position that loads in the <head>, or use a plugin like “Head Tag”.

By following these steps, your Joomla website will be fully GDPR-compliant with Consentise handling cookie preferences and tracking consent.