Skip to content

GDPR

Modules: Magenx_Gdpr (registry, logs, admin, cron) and Magenx_GdprGraphQl (storefront API)

Tools for GDPR compliance on a headless store:

  • a cookie registry that feeds the storefront’s cookie policy page with the cookies the site really sets;
  • a consent log of every cookie-banner decision;
  • self-service data requests: customers export, anonymize or ask to erase their data from their account;
  • optional retention automation for dormant accounts and old order addresses.
The cookie policy page listing cookie groups and cookies
Cookie policy page, fed by the cookie registry.

Manage it under Customers > GDPR > Cookie Groups and Cookies. Groups match the storefront’s consent categories: necessary, analytics, marketing and preferences.

Install fills it with the cookies this stack sets (sign-in, session and language cookies) and Google’s:

  • Google Analytics cookies are active, matching the Tag Manager container the stack ships with. Deactivate them if you run no Tag Manager.
  • Google Ads / DoubleClick cookies are inactive. Activate them when you add ad tags.
  • When a third-party script sets its own cookie, add it here so the policy page stays accurate.

Only active cookies reach the storefront. To restore the default rows: bin/magento magenx:gdpr:seed-cookies. It never touches rows you added.

Every cookie-banner decision is recorded: customer (when signed in), IP address and the categories granted. See Customers > GDPR > Consent Log (read-only). Old entries are pruned after the retention period.

Cookie Preferences dialog: necessary cookies always active, switches for analytics, marketing and preference cookies, and Decline All, Save My Choices and Accept All buttons
The storefront's cookie preferences. Each choice saved here is a consent-log entry.

From their account, a signed-in customer can:

  • Export their data: profile, addresses, order summary and consent history, downloaded in the browser. The export is logged.
  • Anonymize their data, immediately.
  • Request erasure, which waits for approval in Customers > GDPR > Data Requests.
Privacy page in the customer account: Download my data, Anonymize my data and Request erasure, above the list of the customer's data requests
Privacy page in the customer account.

Anonymizing rewrites names, emails, birth dates, tax/VAT numbers, addresses and phone numbers on the account, its addresses and its orders, including the admin order grid and the newsletter record. It also signs the customer out everywhere. Order totals and items are kept: they are the merchant’s accounting records.

The export covers this module and Magento’s core customer and sales data. Data kept by other extensions is not included unless they add it (as Rewards does).

Off by default, apart from consent-log pruning:

  • anonymize dormant accounts: no sign-in and no order within the window;
  • anonymize old order addresses.

Each run handles at most 200 records, so a backlog clears over several nights.

Cookie policy

  1. The merchant maintains categories and cookies; only active cookies are published.
  2. The storefront shows them on the policy page and in the banner.

Consent

  1. A visitor chooses categories in the banner.
  2. The decision is recorded with customer (if signed in), address, categories and time.
  3. A signed-in customer repeating their current choice adds no record; guest decisions are always recorded.

Export

  1. A customer downloads profile, addresses, order summary and consent history.
  2. The access is recorded as a completed export request (repeats within 5 minutes count once).

Anonymise now

  1. A customer asks to anonymise their data; if no order is in progress and no request of that kind is pending, it runs at once and is marked completed.

Erase

  1. A customer requests erasure; it waits for review.
  2. An admin approves (anonymisation runs; status approved) or denies with a note.

Retention

  1. Nightly, consent records past retention are removed.
  2. When enabled, dormant accounts and old orders are anonymised, 200 per run, each run continuing where the last stopped.

Banner and policy

  1. The storefront loads the register (cacheable) and shows categories and cookies.
  2. The visitor decides; the storefront sends the three optional categories.

Privacy page

  1. The customer downloads their data; the storefront builds a file from the response.
  2. They see past requests with statuses and notes.
  3. They anonymise now or request erasure.

These always hold:

  • After anonymisation, no covered field identifies the customer.
  • Anonymisation never changes totals, items or invoices.
  • Consent records are never edited; they leave only by retention.
  • At most one pending request per customer and type.
  • Customer operations act only on the signed-in customer.
  • Private responses are never cacheable; the register is.
  • All actions run in the back office; this layer only maps data.
  • Dormant when last sign-in and last order are both older than the age, or absent.
  • Consent records older than retention are removed.
  • An anonymised customer is signed out everywhere.
  • A large backlog drains over several nights without timeouts.
SituationWhat happens
Anonymise while an order is being processed.Refused.
Second erasure request while one is pending.Refused.
Anonymiser fails midway.Request not marked done.
Customer had unsubscribed from the newsletter.Stays unsubscribed.
Old-order job run twice.Second run handles a different batch.
Consent recorded behind a proxy that hides the visitor address.Proxy address stored; deployment must pass the real address.
Inactive cookie.Not published.
Feature off for the store view.Register empty; other operations error.
Guest asks for an export.Not authorised.
Export twice within 5 minutes.One recorded request.
Another feature adds its data to the export.Included without either depending on the other.
  • Requests and export: signed-in customers. Consent: everyone. Register: public.
  • Register and consent: everyone. Requests and export: signed-in customers.
  • Hard deletion of customers or orders.
  • Personal data held by other features (they must extend the anonymiser and export).
  • Per-store-view cookie registers.
  • Blocking scripts before consent (the storefront does that).
  • Editing legal texts.
  • Admin operations through the storefront API.
  • Asynchronous export files.
Terminal window
composer require magenxcommerce/module-gdpr magenxcommerce/module-gdpr-graph-ql
bin/magento module:enable Magenx_Gdpr Magenx_GdprGraphQl
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
  • PHP ~8.4.0||~8.5.0, Magento 2.4.8.

The master switch is per store view. The retention settings are global, because the cron jobs they control run for the whole installation.

Stores > Configuration > Magenx > GDPR

General

SettingDefaultScopeNotes
Enabled
magenx_gdpr/general/enabled
YesStore viewYes/No. Master switch. Turns off the cookie registry query and consent/request mutations for this store when disabled.

Consent Log

SettingDefaultScopeNotes
Retention (days)
magenx_gdpr/consent_log/retention_days
180GlobalText. Shown when magenx_gdpr/general/enabled = Yes. How long cookie-consent log rows are kept before the daily prune cron removes them.

Dormant Account Anonymization

SettingDefaultScopeNotes
Enabled
magenx_gdpr/dormant_accounts/enabled
NoGlobalYes/No. Shown when magenx_gdpr/general/enabled = Yes. Danger: once enabled, the cron anonymizes matching customer accounts automatically. Back up the database first.
Days Since Last Order/Login
magenx_gdpr/dormant_accounts/days
365GlobalText. Shown when magenx_gdpr/general/enabled = Yes, magenx_gdpr/dormant_accounts/enabled = Yes. A customer with no order and no sign-in for this many days is anonymized by the daily cron.

Old Order Anonymization

SettingDefaultScopeNotes
Enabled
magenx_gdpr/old_orders/enabled
NoGlobalYes/No. Shown when magenx_gdpr/general/enabled = Yes. Danger: once enabled, the cron anonymizes billing/shipping names and addresses on matching orders automatically. Order totals and items are never touched. Back up the database first.
Order Age (days)
magenx_gdpr/old_orders/days
730GlobalText. Shown when magenx_gdpr/general/enabled = Yes, magenx_gdpr/old_orders/enabled = Yes. Orders older than this many days have their address PII anonymized by the daily cron.
  • Customers > GDPR > Cookie Groups
  • Customers > GDPR > Cookies
  • Customers > GDPR > Consent Log
  • Customers > GDPR > Data Requests

Grant these under System > Permissions > User Roles > Role Resources:

ResourceUnderID
GDPR SectionStores > Settings > ConfigurationMagenx_Gdpr::config
GDPRCustomersMagenx_Gdpr::gdpr
Cookie GroupsCustomers > GDPRMagenx_Gdpr::cookie_groups
CookiesCustomers > GDPRMagenx_Gdpr::cookies
Consent LogCustomers > GDPRMagenx_Gdpr::consent_log
Data RequestsCustomers > GDPRMagenx_Gdpr::requests
JobGroupDefault scheduleChange it at
magenx_gdpr_anonymize_dormant_accountsdefault0 2 * * *Fixed
magenx_gdpr_anonymize_old_ordersdefault30 2 * * *Fixed
magenx_gdpr_prune_consent_logdefault0 3 * * *Fixed

gdprCookieGroups is public and cacheable. submitCookieConsent works for guests, since most decisions happen before sign-in; rate-limit it at your proxy or CDN. The other operations need a customer token. With the module switched off, gdprCookieGroups returns an empty list and the rest return an error.

Queries

gdprCookieGroups: [GdprCookieGroup]

The store's cookie categories and the cookies declared in each, for the cookie policy page and consent banner.

myGdprRequests: [GdprRequest]

The logged-in customer's data-subject request history. Never cached: the answer is private to the signed-in customer.

myPersonalDataExport: GdprPersonalDataExport

The logged-in customer's own profile, addresses, order summary and consent history, for download. Logs a completed export_data request. Never cached: the answer is private to the signed-in customer.

Mutations

submitCookieConsent(input: GdprConsentInput!): Boolean

Records a visitor's cookie-category choices for the audit trail. Works for guests and logged-in customers.

ArgumentTypeDescription
inputGdprConsentInput!
requestGdprAction(input: GdprRequestInput!): GdprRequest

Raises a data-subject request for the logged-in customer. anonymize_data runs immediately; erase_data is queued for admin approval. Rejected while a request of the same type is still pending.

ArgumentTypeDescription
inputGdprRequestInput!

Types

enum GdprRequestTypeEnum - The kind of data-subject request a customer can raise.
ValueDescription
EXPORT_DATAGet a copy of my personal data.
ANONYMIZE_DATAReplace my personal data with anonymized values, keeping the account.
ERASE_DATAAnonymize my personal data across the account and its order history, and sign the account out everywhere. Requires admin approval.
enum GdprRequestStatusEnum - The lifecycle state of a data-subject request.
ValueDescription
PENDINGWaiting for admin review (erase requests only).
APPROVEDApproved by an admin; the underlying action has run.
DENIEDRejected by an admin.
COMPLETEDThe requested action has run (export / anonymize run immediately).
type GdprCookieGroup - A cookie consent category (necessary, analytics, marketing, preferences).
FieldTypeDescription
codeStringCategory code.
labelStringDisplay label.
descriptionStringExplanation shown to visitors.
is_requiredBooleanWhether this category cannot be declined.
cookies[GdprCookie]The active cookies declared in this category.
type GdprCookie - A single cookie this store sets or relies on.
FieldTypeDescription
nameStringCookie name, or a trailing-* prefix (e.g. _ga_*).
purposeStringWhat the cookie is for.
duration_labelStringHow long it lives, as display text (e.g. "1 hour", "Session").
sourceStringWho sets it: storefront, auth or google.
input GdprConsentInput - A visitor's choice for each non-essential cookie category. necessary is implied and always granted.
FieldTypeDescription
analyticsBoolean!
marketingBoolean!
preferencesBoolean!
input GdprRequestInput - Input for raising a data-subject request.
FieldTypeDescription
typeGdprRequestTypeEnum!
noteStringOptional note from the customer. Stored as customer_note and truncated at 1000 characters.
type GdprRequest - A data-subject request and its current status.
FieldTypeDescription
idInt
typeGdprRequestTypeEnum
statusGdprRequestStatusEnum
customer_noteStringThe note the customer attached when raising the request.
admin_noteStringNote recorded by the admin when approving or denying.
requested_atString
resolved_atString
type GdprPersonalDataExport - The logged-in customer's own data, for a client-side download.
FieldTypeDescription
generated_atString
profileGdprExportProfile
addresses[GdprExportAddress]
orders[GdprExportOrder]
consent_history[GdprExportConsent]
type GdprExportProfile
FieldTypeDescription
firstnameString
lastnameString
emailString
date_of_birthString
type GdprExportAddress
FieldTypeDescription
firstnameString
lastnameString
street[String]
cityString
regionString
postcodeString
country_codeString
telephoneString
type GdprExportOrder
FieldTypeDescription
increment_idString
created_atString
statusString
grand_totalFloat
type GdprExportConsent
FieldTypeDescription
contextString
necessaryBoolean
analyticsBoolean
marketingBoolean
preferencesBoolean
created_atString
TermMeaning
Cookie categoryConsent group: necessary (always on), analytics, marketing, preferences.
CookieName or prefix, purpose, lifetime text, who sets it, category, active flag.
Consent decisionGranted / denied per category at one moment.
Data-subject requestExport, anonymise or erase, with status: pending, approved, denied, completed.
AnonymiseReplace personal fields with neutral values, keeping the records.
EraseAnonymise across account and order history and sign out everywhere, after admin approval.
Dormant accountNo sign-in and no order within N days.
Retention windowDays before records are pruned or anonymised.