Webotic
Free audit
Back to blogANALYTICS · TECHNICAL GUIDE

GA4 for Moroccan e-commerce in 2026 — the full setup.

A studio playbook for configuring Google Analytics 4 on a Moroccan merchant: enhanced ecommerce data layer, now-free BigQuery export, CMI redirect handled without breaking tracking, Consent Mode v2, data-driven attribution. Field-tested across 45 merchants in 2025-2026.

−22%Measured CPAdata-driven vs last-click · 28 accounts
1 TBBigQuery freeper month · since July 2023
10MGA4 sampling thresholdevents per exploration
3-5 dDeployment timestandard Shopify or WooCommerce
01

Why default GA4 doesn't hold for a Moroccan merchant

Universal Analytics died in July 2023, GA4 took over, and most Moroccan e-commerces settled for the basic GA4 tag pushed through Google Tag Manager: a script glued in, an account created, an Acquisition view checked once a week. That default config works — it surfaces sessions and conversions — but it masks three things that matter for an operator in Casablanca, Rabat or Tangier. First, currency. GA4 defaults to the account currency, usually USD. If you don't explicitly send currency: 'MAD' in every ecommerce event, revenue surfaces converted at a frozen rate, and every ROAS report you read is mathematically wrong. Second, the specifically Moroccan purchase journey. On 78% mobile traffic, the consumer discovers via Meta or TikTok, searches the brand on Google two days later from a desktop at the office, and finalises through CMI or cash on delivery. Without an enhanced ecommerce data layer, that journey shows up as two distinct visitors, and the discovery channel gets no credit. Third, sampling. GA4 samples as soon as an exploration crosses 10 million events, which arrives fast on an average e-commerce account — 30,000 monthly visitors is enough. At that point, your numbers stop being exact, they're extrapolated. Across the 45 Moroccan merchants Webotic audited in 2025-2026, the median gap between back-office revenue and GA4 revenue was 31%.

  • Default USD currency: without explicit currency: 'MAD', every ROAS is biased.
  • 78% mobile traffic + desktop finalisation = cross-device journey invisible without a clean data layer.
  • GA4 sampling triggers past 10M events per exploration — reached at 30k monthly visitors.
  • Median back-office vs GA4 revenue gap: 31% across 45 audited Moroccan accounts.
02

The enhanced ecommerce data layer architecture

The data layer is the structured layer your site pushes into window.dataLayer, and that GTM reads before forwarding to GA4. Without an enhanced ecommerce data layer, GA4 receives only generic page_view events. With a properly wired layer, every funnel step is tracked with its parameters: product, price, quantity, currency, shipping tier, payment method, transaction identifier. The canonical GA4 e-commerce sequence fits in six official events. view_item fires on product page load, with item_id, item_name, item_category, price, currency: 'MAD'. add_to_cart on click of the cart button, with item and value. begin_checkout when entering the checkout, with full items[] and total value. add_shipping_info on shipping selection, with shipping_tier (intra-Casablanca, out-of-town delivery, pickup point). add_payment_info on payment method selection — the critical Moroccan node: payment_type can be 'cmi', 'cod' (cash on delivery) or 'transfer'. purchase on order confirmation, with unique transaction_id for deduplication, value, tax, shipping, items[]. On Shopify, the custom DataLayer is injected via theme.liquid at the bottom of checkout — apps like Elevar or GTM4Shopify automate 80% of the wiring, but we systematically verify that currency: 'MAD' is in every event and that transaction_id is never reused. On WooCommerce, GTM4WP (free) does the job, provided you enable Enhanced E-commerce and set MAD as the default currency in WooCommerce Settings. On PrestaShop, the official Google Tag Manager Pro module remains paid for the refund and add_shipping_info events — essential for full coverage.

  • Six canonical GA4 events: view_item, add_to_cart, begin_checkout, add_shipping_info, add_payment_info, purchase.
  • Unique transaction_id per order: without it, GA4 double-counts on page reload.
  • Shopify: Elevar or GTM4Shopify + theme.liquid · WooCommerce: GTM4WP free · PrestaShop: paid Pro module.
  • Always force currency: 'MAD' in every event — the account default currency otherwise breaks everything.
03

CMI redirect: where tracking actually breaks

This is the node that separates a Moroccan setup from a standard one, and where most integrations crack. The Centre Monétique Interbancaire is the mandatory gateway for card payment in Morocco. When the customer clicks 'Pay', your site redirects them to paiement.cmi.co.ma, the user enters their card on the CMI domain, validates, then CMI sends them back to your return URL — typically /checkout/success or /thank-you. The problem: during that loop, the browser leaves your domain, loses the JavaScript context, and tracking cookies can reset depending on SameSite settings and Safari ITP configuration. The frequent outcome: the purchase event never fires, or it fires with a different GA4 client_id from the original session. The conversion surfaces as an anonymous direct visitor, dissociated from the acquisition campaign. Three measures restore the signal. One, mark your CMI return URL as a referral exclusion in GA4 (Admin → Data Streams → More tagging settings → List unwanted referrals → add paiement.cmi.co.ma). Without that exclusion, GA4 attributes the conversion to CMI as traffic source. Two, push the purchase event server-side via GA4 Measurement Protocol from your back office, on receipt of the CMI confirmation webhook, retrieving the client_id from the _ga cookie read server-side. That path is the only reliable one under Safari ITP. Three, add a browser-side fallback on the thank-you page: if window.dataLayer exists but the transaction hasn't yet been pushed (CMI return with expired session), push the purchase event anyway with the transaction_id — GA4 dedupes on that identifier. Across the accounts we audited, those three measures combined recover 60 to 75% of CMI conversions that were previously invisible.

  • Exclude paiement.cmi.co.ma from GA4 referrals — otherwise conversions attribute to CMI as a source.
  • Reliable path: purchase pushed server-side via Measurement Protocol from the CMI webhook back office.
  • Browser fallback on thank-you page: push purchase with transaction_id, GA4 dedupes.
  • Typical recovery: 60 to 75% of invisible CMI conversions become traceable again.
04

BigQuery export: why it became mandatory in 2026

Until July 2023, BigQuery export was reserved for GA4 360 accounts at 150,000 USD/year. Since then, Google made it free for all standard GA4 accounts, capped at one million exported events per day and storage paid at the regular BigQuery rate (10 GB free/month, then around 0.02 USD/GB beyond). For a typical Moroccan e-commerce — 50,000 to 300,000 events per day — the export sits well inside the free quota, and the final monthly BigQuery bill is 5 to 25 MAD/month. It's the only way to escape sampling. Inside the GA4 interface, as soon as an exploration crosses 10 million events on the period, results are sampled and a disclaimer surfaces at the top of the report ('this analysis is based on 23% of sessions'). At 23% sampling, your numbers aren't strictly wrong, but they stop being stable: running the same exploration twice gives two different numbers. BigQuery bypasses sampling entirely: you query raw events in SQL, the result is exact. Three critical queries to wire into Looker Studio from day one. One, the cohort funnel by source: how many Meta Ads visitors seen in April bought in May, June or July — impossible natively in GA4. Two, CLV by acquisition cohort: cumulative revenue at 30, 90, 180 and 365 days. Three, multi-touch deduplication: count of transactions where Meta and Google both claimed credit (across our clients, 12 to 18% of purchases). Activation is a one-shot in Admin → BigQuery Linking, on a GCP project created for the occasion. Streaming starts within 24 hours.

  • BigQuery export free since July 2023: 1M events/day included, final bill 5-25 MAD/month.
  • Past 10M events/exploration, GA4 samples — disclaimer visible in the interface.
  • BigQuery escapes sampling: SQL on raw events, exact and reproducible results.
  • Critical use cases: cross-month cohort funnel, CLV by cohort, Meta vs Google dedup.
05

Funnel report or exploration: picking the right tool

GA4 offers two families of e-commerce reports. The prebuilt native reports (Reports → Monetization → E-commerce purchases, Acquisition → Traffic acquisition) cover the basics: revenue by source, top products, transactions. They're fast, unsampled below 10M events, but frozen — no custom dimension, no complex filter. The explorations (Explore → Funnel exploration, Path exploration, Cohort exploration) unlock full analytical depth but get sampled. The right reflex: use funnel exploration for the monthly diagnostic, fall back to BigQuery as soon as sampling appears. Building a useful funnel exploration fits in five steps. Step 1: view_item. Step 2: add_to_cart. Step 3: begin_checkout. Step 4: add_payment_info. Step 5: purchase. Reading key: across our Moroccan clients, the major drop is systematically between begin_checkout and add_shipping_info, where shipping fees trigger 35 to 42% of abandonment. The second drop sits between add_payment_info and purchase when the chosen method is CMI — 3D Secure friction and the bank redirect cost another 8 to 15%. Conversely, cash on delivery (COD) has a 91 to 96% add_payment_info → purchase rate, but a 12 to 18% no-show rate at delivery — so you also need to track post-delivery status via a custom delivery_confirmed event pushed from your carrier or back office. Path exploration serves the reverse analysis: start from purchase and walk back the last seven events to map winning paths. Cohort exploration serves CLV — but below 6 months of data, cohorts stay thin.

  • Native reports: fast, unsampled below 10M events, but frozen.
  • Explorations: full analytical depth + custom dimensions, but subject to sampling.
  • Typical Moroccan drop: begin_checkout → add_shipping_info, 35-42% abandonment on shipping fees.
  • COD: 91-96% checkout → purchase rate, but 12-18% no-show — track delivery_confirmed separately.
06

Attribution: data-driven versus last-click

The attribution model has been data-driven by default since April 2023, and that's an underrated shift. Last-click attributed 100% of conversion credit to the last channel touched — usually Google branded search or direct, which systematically undercounted Meta, TikTok and the top of funnel. Data-driven spreads credit across all touchpoints based on their real contribution to triggering the conversion, calculated by a machine-learning model trained on your account. Across the 28 accounts Webotic runs, the last-click → data-driven shift moves on average 18 to 24% of conversion credit from Google branded back to Meta paid and TikTok paid. Direct consequence: your Meta CPA reported in GA4 drops mechanically by that same proportion, surfacing the real profitability of your top of funnel. Three operational caveats. First, the shift is only retroactive over 30 days — historical conversions stay calculated on the model in use at the time. To compare periods, freeze the model in Admin → Attribution Settings or run the comparison in BigQuery. Second, data-driven requires minimum volume: 300 conversions per month over 30 days, and the model auto-activates once the threshold is met. Below that, GA4 silently falls back to last-click — verify the mention in Admin. Third, import your Meta and TikTok cost data via GA4 Data Imports (or via direct Looker Studio connectors) so that reported ROAS is computed on attributed revenue × imported cost — without imported cost, you only have revenue, not ROAS.

  • Data-driven by default since April 2023 — last-click still available in Admin → Attribution Settings.
  • Typical shift: 18-24% conversion credit moved from Google branded to Meta + TikTok.
  • Activation threshold: 300 conversions/month — below that, GA4 silently falls back to last-click.
  • Import Meta/TikTok cost via Data Imports to compute real ROAS directly inside GA4.
07

Consent Mode v2 and Moroccan data layer: compliance wired in

Since March 2024, Consent Mode v2 is mandatory for any advertiser serving EEA traffic, and Webotic recommends wiring it systematically even for 100% Moroccan traffic, because law 09-08 (CNDP) also requires prior consent for advertising tracking. Concretely, Consent Mode v2 adds two signals your Consent Management Platform must forward to Google: ad_user_data (the user consents to sharing identifying data with Google) and ad_personalization (the user consents to ad personalisation). If both signals are denied, GA4 keeps collecting but in anonymised mode (conversion modelling without cookies), and events are not forwarded to Google Ads for remarketing. On a typical Moroccan e-commerce account, the consent granted rate sits at 62 to 78% depending on CMP wording quality — a curt 'Decline' wording drops the rate to 45%, an explicit 'Continue without personalisation' lifts it to 75%. Recommended CMPs: Axeptio (French, free up to 25,000 visitors/month, then 600 to 1,200 MAD/month), Didomi (more complete, 1,000 to 2,500 MAD/month by volume), Cookiebot (European, 250 to 1,800 MAD/month). On the data layer, push a consent_update event at every CMP interaction, with explicit values for each signal — that lets you track in parallel which consent rate each CMP variant achieves and tune the wording. On GTM, configure GA4 and Meta tags with consent_check on ad_storage and analytics_storage so no event escapes consent. The full deployment — CMP + Consent Mode v2 + enhanced ecommerce data layer + BigQuery export — fits in 3 to 5 days for a standard Shopify or WooCommerce, 5 to 8 days for a PrestaShop or custom build.

  • Consent Mode v2 mandatory for EEA traffic since March 2024 — recommended even for 100% MA traffic.
  • Signals to forward: ad_user_data + ad_personalization · denied = anonymised collection, no remarketing.
  • Typical Moroccan granted rate: 62-78% by CMP wording — can fall to 45% on bad wording.
  • Full deployment (CMP + Consent v2 + data layer + BigQuery): 3-5 d Shopify/Woo, 5-8 d PrestaShop/custom.

FREQUENTLY ASKED

GA4 or Universal Analytics — which one in 2026?
Universal Analytics has been gone since July 2023, the question is moot in 2026. GA4 is the only active Google Analytics. If you still need historical comparisons against UA, exporting UA data into BigQuery via the graceful shutdown Google offered before July 2024 was the only route; past that, the old data is no longer accessible. GA4 uses an event-driven model instead of UA's session model, and all analytical depth now flows through explorations and BigQuery.
How do you track a CMI-routed conversion without breaking the funnel?
Three combined measures. One, exclude paiement.cmi.co.ma as a referral in GA4 Admin (otherwise GA4 attributes the conversion to CMI as traffic source). Two, push the purchase event server-side via GA4 Measurement Protocol from your back office on receipt of the CMI confirmation webhook, passing the client_id read server-side from the _ga cookie. Three, add a browser fallback on the thank-you page that pushes purchase with the transaction_id — GA4 dedupes on that identifier. The combination recovers 60-75% of previously invisible CMI conversions.
Is BigQuery export really free for a Moroccan e-commerce?
Yes, within Google Cloud quota limits. Since July 2023, GA4 → BigQuery export is free for standard GA4 accounts up to 1 million events/day (intermediate streaming) or unlimited daily batch. BigQuery storage includes 10 GB free/month, then around 0.02 USD/GB. For a typical Moroccan e-commerce with 50,000 to 300,000 events/day, the final monthly bill lands at 5 to 25 MAD/month. Past 10 million events per exploration, BigQuery is the only way to avoid GA4 sampling.
Native funnel report or exploration — what's the difference?
The native funnel report (Reports → Monetization) is fast, unsampled below 10M events, but frozen — no custom filter, no secondary dimension. The funnel exploration (Explore → Funnel exploration) unlocks full depth: custom steps, segments, comparisons, secondary dimensions. The trade-off: it gets sampled past 10 million events over the period. The rule of thumb: explorations for the monthly diagnostic, BigQuery as soon as sampling shows up, native reports for automated weekly monitoring.
Past how many events does GA4 start sampling?
Prebuilt native reports (Reports tab) are not sampled regardless of volume. Explorations (Explore) get sampled as soon as the query needs to crunch more than 10 million events over the selected period. A Moroccan e-commerce account with 30,000 monthly unique visitors typically generates 8 to 12 million events/month — so sampling triggers as soon as you look at a window longer than 30 days. The disclaimer surfaces at the top of the report ('based on X% of sessions'). BigQuery is the only sampling-free path.
Data-driven or last-click attribution — which one?
Data-driven by default since April 2023, and usually the right choice for a Moroccan e-commerce. Across 28 Webotic accounts, the last-click → data-driven shift moves 18 to 24% of conversion credit from Google branded back to Meta paid and TikTok paid, surfacing the real profitability of the top of funnel. Caveat: data-driven needs 300 conversions/month minimum, otherwise GA4 silently falls back to last-click. To compare historical periods, freeze the model in Admin → Attribution Settings or do the comparison in BigQuery.
How long does a full GA4 configuration take in Morocco?
For a standard Shopify or WooCommerce: 3 to 5 days for the full deployment, covering the enhanced ecommerce data layer, six canonical events with explicit MAD currency, handled CMI redirect, Consent Mode v2 via Axeptio or Didomi, BigQuery export enabled and three Looker Studio queries wired in. For PrestaShop or custom builds: 5 to 8 days. ROI shows up in the first month through the reported CPA drop driven by data-driven attribution and the recovered CMI conversions that were previously invisible.
GA4 AUDIT · 30 MIN · FREE

We audit your GA4 e-commerce setup

You grant us read-only access to GA4 and Google Tag Manager. Within 48 hours we return a short document: data layer coverage, missing events, MAD currency wired or not, CMI redirect clean or not, sampling encountered, and a plan priced in MAD. No slides, no pitch — just the audit. If your config already holds, we say so plainly.

Request my GA4 audit