Skip to content

GDPR Extension

The Magebit GDPR Extension adds GDPR tooling to a Venta/Hyvä store: a cookie consent bar with grouped cookies, Google Consent Mode v2, a per-accept consent log, and a customer Privacy section in My Account covering data download, account deletion with a grace period, and irreversible anonymization. Anonymization events are written to an admin audit log.

Installation

Install the GDPR extension using Composer.

Installation Command:

bash
composer require magebitcom/magento2-module-gdpr

Post-Installation Steps:

bash
bin/magento module:enable Magebit_GdprExtension
bin/magento setup:upgrade
bin/magento cache:flush

Configuration Access: Navigate to Stores > Configuration > Magebit > GDPR to access GDPR configuration options.

The cookie consent bar relies on Magento's built-in Cookie Restriction Mode. Without it the bar still renders, but Magento keeps setting cookies regardless of the visitor's choice.

  1. Go to Stores > Configuration > General > Web.
  2. Open Default Cookie Settings.
  3. Set Cookie Restriction Mode to Yes, save, and flush the cache.

Extension Configuration

The module is disabled by default. Configure it under Stores > Configuration > Magebit > GDPR. Each section below is a config group; every field also has an inline admin description.

GDPR configuration

General Settings

  • Enable GDPR - Master switch for the entire module.

General Settings

Configuration options

FieldDescription
Activate Cookie Notification BarShow the consent bar to visitors who have not yet made a choice.
Show Cookie Settings Badge on PageDisplay a floating badge that re-opens cookie preferences after the notification bar is closed.
Automatic Cookie Log Cleanup Interval (DaysDays to retain consent log records before automatic purge.

Cookie Bar Settings

Configuration options

FieldDescription
Cookie Bar TitleHeading shown at the top of the cookie notification bar.
Consent Message TextText shown inside the cookie notification bar.
About Tab TextText shown on the About tab of the consent modal.
Cookie Declaration TextShown in the Details tab footer. Supports links and HTML; use %1 for the last-updated date.

Cookie Bar Customization

Configuration options

FieldDescription
EnableSend the visitor's consent state to Google Consent Mode v2.
Permission TypesMap each Google consent type (ad_storage, analytics_storage, functional, and so on) to a cookie group and set its default state.

Consent Mode

GDPR Features

  • Days until account is deleted - Grace period before a deletion request is finalised by cron.

GDPR Features

Account Deletion Settings

Configuration options

FieldDescription
Prevent Deletion for Customer GroupsCustomer groups that are not allowed to delete their accounts.
Prevent Deletion for Order StatusesCustomers with orders in these statuses cannot delete their accounts.
Deletion Confirmation MessageShown after a successful deletion request (use %d for the day count).
Deletion Prevention MessageShown when deletion is blocked by a restriction.
  • Deletion Card Description / Deletion Modal Description - Text shown on the deletion card and its confirmation modal.
  • Cancellation Card Description / Cancellation Modal Description - Text shown on the cancellation card and modal (use %s for the deletion date).

Account Deletion Settings

Account Anonymization Settings

Configuration options

FieldDescription
Prevent Anonymization for Customer GroupsGroups that cannot anonymize. Falls back to the deletion restrictions when empty.
Prevent Anonymization for Order StatusesOrder statuses that block anonymization. Falls back to the deletion restrictions when empty.
  • Anonymization Card Description / Anonymization Modal Description - Text shown on the anonymization card and its confirmation modal.
  • Audit Log Retention (Days) - Days to retain anonymization audit records before purge. Default 1095 (3 years).

Account Anonymization Settings

My Account Tab

Configuration options

FieldDescription
Enable Privacy tabShow the Privacy section in the customer's My Account.
Privacy tab nameLabel for the Privacy section in the account navigation.
Allow Policies / Downloading / anonymizing / Deletion / consent tab / Data Protection OfficerToggle each card in the Privacy section.
  • Data officer section Name / Data Protection Officer Information - Heading and text for the Data Protection Officer card.

My Account Tab

The bar is Hyvä-native (Alpine.js and Tailwind). It renders site-wide, stores the choice in a first-party cookie, writes a consent-log row per accept, and cleans up cookies when consent is withdrawn. Consent and the log are scoped per website. The bar has three tabs: Consent (per-group toggles), Details, and About.

Cookie consent bar

The Details tab lists each cookie group with its cookie count, and expands to the providers and cookies inside each group.

Cookie group details

Expanding a provider reveals its individual cookies with their purpose, storage type, and lifetime:

Provider cookies

With Show Cookie Settings Badge enabled (see Cookie Bar Settings), a floating badge lets visitors re-open the preferences after the bar is closed.

Cookies and groups are managed under the top-level Magebit GDPR admin menu.

Cookie names other modules depend on

The consent groups defined here are read by other extensions to decide whether their own scripts may load. Klaviyo Subscription holds klaviyo.js back until the group containing __kla_id is consented to, and if no group declares that cookie the script never loads at all. Check that any cookie an integration gates on is actually listed in a group.

Cookies

Magebit GDPR > Cookies lists individual cookies (name, provider, group, created/updated). Use Add New Cookie to create one, or Import / Export to manage them in bulk.

Cookies grid

Magebit GDPR > Cookie Groups defines the groups shown in the consent bar (Essential / Marketing / Analytics / custom).

Configuration Options:

  • Name and Code - the code is the stable identifier used by consent-mode mapping and the stored consent.
  • Active - Whether the group is used at all.
  • Essential - Always on and cannot be declined (for strictly necessary cookies).
  • Show in consent - List the group in the consent bar.
  • Description - WYSIWYG text shown under the group in the Details tab.
  • Included Cookies - The cookies assigned to the group.
  • Sort order and store-view scope.

Cookie groups grid

Import and Export Cookies (CSV)

The module ships prepared cookie lists (CSV) for English (en_US) and Latvian (lv_LV) under Setup/Data/CookiePacks/, covering common providers: Adobe Commerce, Cloudflare, Google, Facebook, Instagram, Klaviyo, Mollie, and PayPal. On install only a default set is seeded; the provider packs are not imported automatically. Import the ones you need with the Import action below, or use them as a template for your own.

The Cookies grid has Export and Import actions for managing the catalog in bulk.

  • Export downloads the current cookies as a CSV file.
  • Import uploads one or more .csv files into the store views you select. Import fills existing groups by their group code; it does not create groups, so define the groups first. Uploads are validated server-side and only .csv is accepted.

The CSV columns are cookie_name, group_code, code, cookie_provider, provider_url, cookie_lifetime, cookie_type, storage_type, cookie_description.

Import cookies modal

Use the grid's mass actions to delete cookies in bulk.

Magebit GDPR > Cookie Consents Log records one row per accept event: customer, IP, email, action, website, policy version, and date.

Cookie consents log

Customer Privacy Section

A cards-based Privacy section under My Account at gdpr/customer/index. Each card is toggled independently from My Account Tab in config. Destructive actions (download, anonymize, delete) require password reauthentication.

Customer Privacy section

The cards are:

  • Your Privacy Policies - Links to the terms, privacy, and return policy pages.
  • Consent Preferences - Re-opens the cookie-group consent modal from the account.
  • Data Protection Officer - Shows the DPO contact info configured in admin.
  • Download Your Data - Exports the customer's data as a ZIP of CSV files.
  • Anonymize Data - Runs an irreversible scrub of personal data.
  • Delete Account - Schedules deletion after a grace period.

Personal Data Download

The customer confirms with their password and receives a ZIP of CSVs covering their account, addresses, wishlist, reviews, compared and viewed products, downloadable products, coupon usage, PayPal billing, and price alerts.

Account Deletion (Grace Period)

A deletion request is password-confirmed and sets a deletion date on the account. A daily cron (delete_users) finalises it after the configured number of days (GDPR Features) by anonymizing, then deleting the record. The customer can cancel from the Privacy section before the cron runs. Deletion is blocked when the customer is in a restricted group or has orders in a restricted status (see Account Deletion Settings).

Delete account modal

Account Anonymization (Irreversible)

Anonymization is password-confirmed and runs a transactional scrub across the customer's data surfaces (cart, wishlist, reviews, addresses, newsletter, coupons, payment tokens, and more). Sales records keep country, region, city, and aggregate totals for tax-audit evidence; direct identifiers and high-granularity fields (street, postcode, phone, IP) are removed. The customer is logged out and sent to a confirmation page. Each run writes an audit row with a random UUID and no customer-identifying data. The same group and order-status restrictions apply (see Account Anonymization Settings).

Anonymize data modal

Anonymization Log

Magebit GDPR > Anonymization Log is the audit trail of anonymization events: event UUID, timestamp, store, and outcome. It holds no PII or customer reference. A daily cron purges rows older than the configured retention (Account Anonymization Settings, default 1095 days).

Anonymization log

Auditing PII Coverage (CLI)

After installing third-party modules that store customer data, run the audit to find tables with PII-shaped columns that no anonymization strategy covers.

bash
bin/magento magebit:gdpr:audit          # uncovered tables only
bin/magento magebit:gdpr:audit --all    # also list covered tables
bin/magento magebit:gdpr:audit --json   # machine-readable for CI

The command is diagnostic and changes no data. Its exit code is non-zero when uncovered tables are found.

Extending Anonymization

Projects can add their own scrub steps without editing the vendor module. Implement Magebit\GdprExtension\Service\Anonymizer\Strategy\AnonymizationStrategyInterface (a getCode() and a scrub(ScrubContext $context) method) and append it to the orchestrator via di.xml:

xml
<type name="Magebit\GdprExtension\Service\Anonymizer\CustomerAnonymizer">
    <arguments>
        <argument name="strategies" xsi:type="array">
            <item name="acme_loyalty_points" xsi:type="object">Acme\Loyalty\Service\Anonymizer\Strategy\LoyaltyPointsStrategy</item>
        </argument>
    </arguments>
</type>

All strategies run inside one DB transaction; if any throws, the whole scrub rolls back. ScrubContext exposes customerId, originalEmail, anonymizedEmail, and emailScopeSafe for targeting rows. Re-run magebit:gdpr:audit to confirm coverage.