← Back to all articles Compliance & security 6 min

Morocco Law 09-08 and CNDP website compliance: a practical technical guide

How to implement Morocco Law 09-08 and CNDP rules across business websites, booking portals, and WooCommerce stores: contact forms, cookie consent, HTTPS security, and GDPR.

Whenever a Moroccan website collects a visitor's name, email address, phone number, or tracking identifiers, it falls under Moroccan Law No. 09-08 governing personal data protection, overseen by the CNDP (National Commission for the Control of Personal Data Protection).

In practice, many business websites still deploy raw contact forms without processing notices or conditional Analytics/Ads script loading. This guide outlines the concrete technical and editorial controls to implement during a website build or redesign.

1. Which websites in Morocco fall under Law 09-08?

Contrary to common belief, Law 09-08 does not apply only to banks or telecom providers. Any data controller established in Morocco—or processing data through resources located in Morocco—is subject to the law whenever information identifying an individual is collected.

The most common web scenarios include:

  • Business showcase and quote sites: contact forms, callback requests, and newsletter opt-ins.
  • E-commerce stores (WooCommerce, Shopify): customer accounts, shipping addresses, order logs, and CMI/Stripe checkouts.
  • Medical clinics, accounting firms, and real estate agencies: online appointment booking and document or tenant intake.
  • Hospitality and tourism (riads, tour operators): direct booking forms and airport transfer requests.

2. How Moroccan Law 09-08 (CNDP) aligns with European GDPR

In Marrakech and across Morocco, many companies serve both local residents and European visitors (hospitality, architecture, real estate, export e-commerce, B2B advisory). Website architecture should satisfy both Law 09-08 and GDPR requirements whenever EU visitors are targeted.

Technical or legal criterionLaw 09-08 (Morocco — CNDP)GDPR (European Union)
Prior formalitiesPrior CNDP declaration or authorization depending on data sensitivity and transfersInternal processing records instead of routine prior filings
Form noticesController identity, specific purpose, recipients, mandatory/optional fields, access & correction rightsLegal basis, retention period, access, erasure, portability, and supervisory rights
Cookies & trackers (GA4 / Ads)Clear notice and prior consent before setting non-essential advertising or analytics cookiesExplicit opt-in without pre-ticked boxes; declining must be as straightforward as accepting
Cross-border hostingRegulated under CNDP transfer rules when servers or processors sit outside MoroccoRegulated via adequacy decisions or Standard Contractual Clauses (SCCs)

3. Code-level implementation checklist: forms, cookies, and security

A hastily written privacy policy page achieves nothing if the site source still fires third-party trackers before consent or stores unvalidated submissions. Four concrete engineering steps tighten compliance:

  1. Form minimization and sanitization: request only strictly needed intake fields. Validate input types server-side, sanitize payloads against XSS and injection attacks, and enforce anti-CSRF tokens.
  2. Real script gating before GA4 / Meta / Google Ads: deploy Google Consent Mode v2 or a compliant consent manager that actually holds non-essential tracking tags until explicit opt-in.
  3. Strict HTTPS and HTTP security headers: serve all routes over TLS, enforce HSTS, and restrict external script origins via Content-Security-Policy (CSP).
  4. Bounded retention: schedule periodic cleanup of legacy contact entries stored in WordPress tables or connected CRM tools.
  • ✓ Explicit privacy notice directly beneath every form linking to /en/privacy
  • ✓ Opt-in checkboxes never pre-selected for marketing updates or quote intakes
  • ✓ Cookie banner offering Accept, Reject, and Preferences at equal visual prominence
  • ✓ Active SSL/TLS encryption, server-side input validation, and encrypted backups
Ali Ouarzazi
Important legal disclaimer
This guide focuses on technical web engineering and security patterns supporting compliance workflows. Legal classification of data processing and formal CNDP filings—especially for healthcare or financial firms—should always be reviewed with legal counsel.

4. Sector specifics: CMI WooCommerce stores, medical clinics, and accounting firms

Several active sectors in Marrakech require stricter technical separation from the initial specification:

  • E-commerce (WooCommerce / Shopify + CMI Morocco): never store raw payment card numbers inside your own database; delegate card input entirely to PCI-DSS-compliant CMI or Stripe hosted checkout pages.
  • Medical clinics and practitioners: public appointment forms should collect only identity, general specialty, and callback contact details—never encourage patients to upload detailed medical records over plain email.
  • Accounting and corporate advisory firms (fiduciaires): avoid receiving balance sheets, ID scans, or corporate deeds through a public WordPress form; use an authenticated portal or encrypted document channel.

Key takeaway

Embedding Law 09-08 and GDPR principles from day one—minimized forms, strict HTTPS, genuine consent gating, and clear privacy notices—protects visitors while strengthening institutional trust for your business in Marrakech and across Morocco.

Frequently asked questions

Does a basic contact form on a Moroccan business website require Law 09-08 compliance?

Yes. As soon as a form captures a name, email, or phone number to follow up with an inquiry, personal data is collected. You must display controller details, the specific purpose, and how visitors can request access or deletion alongside any applicable CNDP notification.

How can I verify that Google Analytics 4 or Google Ads tags respect visitor consent?

Inspect your browser developer tools (Network and Application/Cookies tabs) in an incognito session before clicking the cookie banner: non-essential tracking cookies must remain blocked prior to consent, and Google Consent Mode signals should default to denied until opt-in.

What is the practical difference between Law 09-08 and GDPR if clients visit from Europe?

Technically, both frameworks enforce transparency, form security, retention limits, and tracker consent. The key Moroccan specificity lies in prior CNDP notifications or authorizations and formal rules governing data transfers outside Morocco.

Can a compliant Moroccan website be hosted in Europe or is a local server mandatory?

Many Moroccan sites use European hosting for infrastructure reliability and latency, yet transferring personal data abroad falls under CNDP rules (Articles 43 and 44 of Law 09-08). Hosting location should always be documented clearly and checked against CNDP transfer requirements.

Ali Ouarzazi

Based in Marrakech, Ali Ouarzazi develops business websites, CMI/Stripe stores, and client portals built around technical Law 09-08 and GDPR data protection practices.

✨ Professional services

Services & technical solutions related to this guide

Discover tailored engineering services by Ali Ouarzazi to implement these strategies:

Ready to discuss your web project?

Direct exchange with Ali Ouarzazi. Clear itemized quote.