GTM Cookie Consent for Magento 2

Advanced Google Tag Manager Consent Mode integration with full Magento admin control

Hikmadh GTM Cookie Consent delivers a robust and scalable consent management solution built specifically for Magento 2. Fully aligned with Google Tag Manager Consent Mode, it ensures that analytics, advertising, and third-party scripts execute strictly based on user authorization.

Designed for performance-driven commerce environments, the module provides granular control over consent categories while maintaining a seamless user experience.

✔ Native Google Consent Mode Integration
✔ Granular Storage-Level Control (Analytics, Ads, Security & More)
✔ Custom GTM Event Triggers for Advanced Tag Logic
✔ GDPR & Privacy Regulation Ready
✔ Optimized for High-Traffic Production Stores

Hikmadh GTM Cookie Consent enables seamless integration with Google Tag Manager Consent Mode, giving merchants full control over analytics, advertising, and tracking technologies. Designed for modern compliance requirements, the module supports GDPR-ready implementations while maintaining performance, flexibility, and ease of configuration within the Magento admin panel.

Key Features

Google Consent Mode Integration: Seamlessly integrates with GTM to manage analytics and advertising tags based on user consent preferences.

Granular Storage Control: Supports functionality, personalization, security, advertising, and analytics storages with individual configuration options.

Admin Configuration Panel: Manage consent settings, default states, visibility rules, and behavior directly from the Magento Admin panel.

Custom GTM Event Triggering: Automatically triggers custom Google Tag Manager events when defined user consent conditions are satisfied.

Automatic Cookie Handling: Automatically blocks, updates, or clears cookies when users modify or withdraw their consent preferences.

User-Friendly Consent Interface: Clean, responsive consent banner and settings modal for simple user preference management.

Production-Ready Architecture: Built for performance, regulatory compliance, scalability, and commercial Magento 2 production environments.

Supported Consent Storages

Hikmadh GTM Cookie Consent fully supports Google Consent Mode with configurable storage categories.

Functionality Storage: Controls essential website features including preferences, language settings, and core site functionality support.

Personalization Storage: Manages content personalization and customized user experience across pages and browsing sessions.

Security Storage: Handles authentication processes, fraud prevention mechanisms, and protection of secure site operations.

Ad Storage: Controls advertising cookies for marketing campaigns and third-party advertisement tracking activities.

Analytics Storage: Manages analytics tracking to measure website traffic, performance metrics, and visitor behavior insights.

Installation

System Requirements

Before installing the Hikmadh Cookie-Consent make sure your environment meets the following requirements:

Magento 2.4.x

PHP 7.4 or higher

Upload Extension Files

Extract the extension package and upload it to:

app/code/Hikmadh/CookieConsent/

Ensure the folder structure remains intact after upload.

 

Enable the Module

Run the following Magento CLI commands:

				
					php bin/magento module:enable Hikmadh_GtmCookieConsent
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

				
			

Verify Installation

After running the commands, log in to your Magento Admin panel.

Navigate to:

Stores → Configuration → General → Hikmadh Cookie Consent

Ensure the module appears in the configuration section.

 

Activate Cookie Consent

Set Enable Module = Yes

Save configuration and clear cache if required.

The cookie consent banner will now appear on your storefront based on the selected layout and position settings.

Configuration

Hikmadh GTM Cookie Consent provides complete control over consent behavior directly from Magento Admin

Stores → Configuration → General → Hikmadh Cookie Consent

Consent Storage Configuration

Each Google consent storage can be individually configured:

Functionality Storage – Controls essential website functionality such as language preferences and core features.

Security Storage – Manages authentication, fraud prevention, and essential security mechanisms.

Analytics Storage – Controls tracking technologies used for performance measurement and traffic analysis.

Ad Storage – Manages advertising-related cookies and third-party marketing technologies.

Personalization Storage – Enables content personalization and user preference tracking capabilities.

For each storage you can:

  • Enable or disable by default
  • Show or hide in the consent widget
  • Lock as read-only to prevent user modification

Ad User Data & Ad Personalization

Ad User Data – Controls consent for collecting user-related advertising data.

Ad Personalization – Manages personalized advertising and interest-based marketing.

Both options allow granular configuration aligned with Google Consent Mode requirements.

Consent Modal Options

Customize how the floating consent banner appears on the storefront:

Layout – Choose visual style (e.g., Cloud layout).
Position – Select display position (e.g., Bottom Right).
Secondary Button Role – Configure action such as Accept Necessary.
Show Third Button – Enable additional action button if required.
Swap Buttons – Change primary and secondary button positions.

Settings Modal Options

Configure the detailed cookie settings popup:

Layout – Select box-style modal layout.
Transition – Choose animation effect (e.g., Slide).
Modal Trigger Selector – Define custom CSS selector to open settings modal.

Advanced Custom Events

Trigger custom Google Tag Manager events based on user consent:

  • Define Event Name
  • Select Required Storages
  • Choose Boolean Operator (AND / OR)
  • Automatically fire GTM event upon valid consent

This enables seamless integration with Facebook Pixel, Google Ads, GA4, or any custom tracking event.

Complete Consent Control for Magento 2

Hikmadh GTM Cookie Consent for Magento 2 provides a complete, production-ready solution for managing user consent in alignment with Google Consent Mode and modern privacy regulations. With granular storage-level control, advanced GTM event triggering, and full Magento admin configuration, the module ensures that analytics, advertising, and third-party technologies operate strictly based on user authorization. Built for scalability, performance, and commercial deployments, it delivers a seamless balance between compliance, flexibility, and user experience for modern Magento 2 stores.