Google Analytics GA4: setup and help

Quick start

  1. Upload the mprgoogleanalytics ZIP through Modules > Module Manager > Upload a module.
  2. Click Configure and enter your GA4 Measurement ID, starting with G- followed by at least six uppercase letters or digits.
  3. Keep Enable Tracking on and review Exclude Employees, User ID Tracking, Enhanced Conversions and Google Signals.
  4. For browser-only setup, turn Server-Side Purchase Fallback off. For server purchases, add a valid Measurement Protocol API Secret and review the server consent requirements below.
  5. Save, then open Diagnostics and run its checks. Repair hook order or module group visibility if indicated.
  6. Open the storefront in a customer browser with your consent setup active and check a product view, cart action and checkout. Enable Debug Mode while checking GA4 DebugView.
  7. Place a test order and verify purchase. If using Measurement Protocol, check the server log and shared cron task, then turn Debug Mode off.

Requires PrestaShop 1.6.0.0 or later and PHP 7.1 or later.

Setup manual

Install and configure

Follow the steps in Quick start.

Settings

Open Configure in Module Manager. Use Settings for IDs and tracking controls. Use Diagnostics for checks. Separate License, Support, Update and Integrity pages are present.

Setting Default What you configure
Enable Tracking Yes Enable eligible storefront tracking and the configured server purchase path. An empty Measurement ID still prevents browser loading.
Measurement ID Empty Enter G- plus at least six uppercase letters or digits. Use your intended GA4 web stream.
Measurement Protocol API Secret Empty Enter at least 20 letters, digits, underscores or hyphens for server purchases. Browser tracking does not require it.
User ID Tracking No Send a salted SHA-256 hash of the logged-in customer ID as GA4 user_id.
Exclude Employees Yes Exclude logged-in employee storefront requests.
Server-Side Purchase Fallback No Recover eligible purchase events after 30 minutes without browser confirmation. Requires a valid ID and API secret. Turn it off for browser-only use.
Measurement Protocol batch limit 20 Set the worker batch. A value below 1 falls back to 20.
Debug Mode No Add debug_mode=true for browser event checks in GA4 DebugView. Turn it off after testing.
Log Retention (days) 90 Keep event log rows for this period. Zero disables age-based cleanup.
Enhanced Conversions No Send available hashed logged-in customer data through gtag('set','user_data',...).
Google Signals No Set allow_google_signals in GA4 configuration. Configure the corresponding option in your GA4 property too.

Enhanced Conversions hashes email, phone, first name, last name, city, region and postcode after trimming and lowercasing. Country ISO is sent without hashing. Address fields come from the customer's first address when available. This option is separate from hashed customer-ID tracking.

Product engagement

Setting Default What you configure
Track high-intent product engagement No Send high_intent_product_engagement for qualifying product interactions or dwell time.
Gallery views threshold 3 Set distinct gallery interactions, from 1 to 20.
Dwell-time threshold 45 Set seconds on the product page, from 5 to 600.

The shared tracker also recognizes variant changes and product detail interactions. Its default behavior limits high intent to once per product/session. Keep this separate from your primary purchase conversion setup.

Storefront events and payloads

The module loads GA4 asynchronously through displayHeader. It sends ecommerce events through these paths:

Event Source
view_item displayProductActions on a product page.
view_cart displayShoppingCart.
add_to_cart, remove_from_cart AJAX cart JavaScript and cart deltas captured before quantity updates for full-page cart rendering.
begin_checkout displayBeforeCarrier.
purchase displayOrderConfirmation.
login, sign_up Pending events from authentication and account creation, emitted on the next eligible header render.
search Search action hooks and a header query fallback.

There are no separate switches for these standard ecommerce events in this settings form. Their presence depends on the corresponding hooks and theme flow.

Purchase data includes the order reference as transaction_id, value, currency, tax, shipping, coupons and line items. Available item fields include ID, name, price, quantity, brand, category, variant and discount. Review these values against a test order with your tax, discount and shipping setup.

Configure custom events

Track custom events defaults to No. Custom event rules starts empty. Add rules, enable the switch and save:

[
  {"event":"gallery_browse","trigger":"click","selector":".product-images img,.images-container img","params":{"component":"product_gallery"},"once":false},
  {"event":"checkout_page_seen","trigger":"url","contains":["/order"],"params":{"area":"checkout"},"once":true},
  {"event":"module_page_seen","trigger":"controller","controllers":["module"],"modules":["mprwishlist"]},
  {"event":"size_guide_opened","trigger":"event","dom_event":"shop:size-guide-opened","params":{"component":"size_guide"},"once":false}
]
document.dispatchEvent(new CustomEvent('shop:size-guide-opened'));

Use event and parameter names starting with a letter, containing letters, digits or underscores, with at most 40 characters. Reserved names and prefixes are rejected. Personal-data-like parameter keys are filtered. Click selectors can have up to 500 characters. once defaults to false for clicks and true for URL, controller and DOM-event rules. Match the controller/module filters to your actual route.

Configure and check server purchases

Order validation records eligible purchases for recovery. After 30 minutes without a browser confirmation, the shared cron task queues and sends eligible Measurement Protocol purchase events using the buyer data captured at checkout:

task: send_ga4_measurement_protocol
callable: mprgoogleanalytics::cronProcessMeasurementProtocolQueue
schedule: every:300
context: any
timeout: 30

Ensure your shared MPR cron runner executes this task. Check the event log in Diagnostics and the shared conversion queue. Log rows use your database prefix followed by mpr_analytics_events; ps_ is only the usual example prefix. Retention cleanup runs after eligible order validation. Purchase recovery expires 72 hours after the order. Recovery record retention follows Log Retention (days).

Browser and server purchases use the order reference as transaction_id. A shared delivery record assigns each purchase to one channel. Server recovery handles only orders still missing a browser confirmation after 30 minutes.

Server client and session IDs come from the original GA cookies captured before the order. Missing or unusable IDs hold recovery; the module does not generate replacement identities. The queue does not make browser-only events server-side.

Verify and troubleshoot

Open Diagnostics and use Run checks. Review required configuration, custom rule validity, hook order, module group visibility, CMP detection, duplicate scripts, exclusions and Measurement Protocol status. Use Repair hook order or Repair module group where relevant.

Use a normal customer browser to check network requests and GA4 DebugView. Bot/audit user agents can be deliberately excluded. Test product view, cart changes, checkout, login, signup, search and a complete order. Verify the transaction reference and item totals.

If no tag loads, check Enable Tracking, the Measurement ID, employee/opt-out exclusions, hook execution and duplicate ownership. If a theme omits displayProductActions or displayBeforeCarrier, the related event may be absent.

If the server purchase is missing, check the fallback switch, ID, secret, capability ownership, queue worker and recent HTTP/error log. An empty secret leaves browser tracking available. GA4 totals can differ from PrestaShop because of blocked scripts, consent, attribution, reporting delays and refunds. This module's purchase tracking is not an accounting reconciliation system.

Disable or uninstall

Set Enable Tracking to No and save to pause this integration. Uninstall through Module Manager to remove its menu, cron registration and module configuration. The shared queue table is kept if another module uses the conversion package; otherwise its uninstall helper drops that table. Manage the GA4 property and its historical data in Google Analytics. The event log uses shared storage; do not drop a shared table manually.

Reference screenshots

Use the setting names above when a reference screenshot differs from your installed version.

Google Analytics GA4, Ga4 demo telemetry monitor

Google Analytics GA4, Ga4 product ecommerce events

Google Analytics GA4, Ga4 search login events

Google Analytics GA4, Admin ga4 diagnostics

Questions

No questions about this module yet

Ask anything about installation, compatibility or setup. Answers appear here.

Known Issues

9

Tracking could use an outdated consent decision

ResolvedUpdated:
Fixed in: 1.5.0
Some tracking paths did not consistently recheck the active consent manager before sending events or matching data.

Staff exclusions were not applied on every tracking path

ResolvedUpdated:
Fixed in: 1.5.0
Shop staff activity could be included by some tracking paths despite the configured internal traffic policy.

Saving settings could clear an existing API secret

ResolvedUpdated:
Fixed in: 1.3.11
Leaving the API secret field blank when saving settings could discard the saved secret and interrupt server-side delivery.

Diagnostics did not report purchase delivery failures

ResolvedUpdated:
Fixed in: 1.3.11
Failed queued or recent server-side purchase attempts could be missed by the diagnostic status.

Credential could not be saved from installation checks

ResolvedUpdated:
Fixed in: 1.3.11
Entering a required tracking credential in the installation-check dialog could fail to save it.

Available translations were not displayed

ResolvedUpdated:
Fixed in: 1.3.11
Some administration messages stayed in English despite installed translations.

Module failed to load on PHP 7.1

ResolvedUpdated:
Fixed in: 1.3.8
Bundled dependency requirements could prevent loading on supported PHP 7.1 installations.

Incorrect translations appeared in the interface

ResolvedUpdated:
Fixed in: 1.3.7
Damaged translation entries caused incorrect interface text in supported shop languages.

Combined storefront assets could break tracking

ResolvedUpdated:
Fixed in: 1.3.6
Tracking assets did not always use the paths required for PrestaShop to combine them correctly.

Feature Requests

16

Implemented

GA4 ecommerce events, diagnostics and purchase event recovery

Implemented
Tracks GA4 ecommerce events and provides a diagnostics dashboard. Optional server-side purchase recovery uses Measurement Protocol only with consent and recorded evidence that browser purchase reporting is missing.

GA4 ecommerce tracking

Implemented
Track shop ecommerce events and review their setup in a diagnostics dashboard.

Custom GA4 event rules

Implemented
Create browser events triggered by clicks, page addresses, page types or browser events, with validation of event names and parameters.

Queued server-side purchase delivery

Implemented
Queue purchase events for delivery through GA4 Measurement Protocol.

Demonstration event monitor

Implemented
Inspect GA4 event activity in the module's demonstration monitor.

Enhanced Conversions

Implemented
Optionally use customer data for improved conversion attribution.

Google Signals setting

Implemented
Choose whether GA4 enables Google Signals for cross-device reporting and remarketing.

Event log retention

Implemented
Choose how long tracking event logs are retained.

Back-office module updates

Implemented
Check for and install module updates from the administration area.

Installation health dashboard

Implemented
Check tracking configuration and module infrastructure, with guided repairs for missing setup.

Additional administration languages

Implemented
Use translated administration screens in French, German, Spanish, Italian and Polish.

Product engagement tracking

Implemented
Measure visitor engagement with product pages.

GA4 tracking ownership coordination

Implemented
Coordinate GA4 tracking with other installed modules to avoid duplicate event delivery.

Contact interaction tracking

Implemented
Optionally track phone, chat and form interactions with consent-aware delivery. New contact tracking settings start disabled.

Missing purchase recovery

Implemented
Recover purchases known to be missing from GA4, with one delivery owner for each destination to reduce duplicate conversions.

Confirmed cart tracking

Implemented
Report confirmed cart changes through the coordinated tracking system.

Changelog

v1.3.42026-09-09

  • AddedAdd GA4 custom event rules
  • AddedQueue GA4 measurement protocol purchases
  • AddedAdd GA4 demo event monitor
  • AddedHarden Google Analytics GA4 tracking
  • Addedcomplete FR/DE/ES/IT/PL translations
  • FixedAdd google analytics infrastructure integrity checks
  • FixedAdd GA4 custom-event diagnostics
  • FixedRemove nested package gitlinks
  • FixedAdd migrateFromPsConfiguration for ps_configuration cleanup
Older releases

v1.2.152026-05-07

  • Fixedthe GA4 search event so search result pages now emit `search` with `search_term` from the page header.
  • Kept login and signup simple-event rendering behind the shared GA4 simple-event helper.
  • Rebuilt and republished the release after live demo verification exposed the missing search-page event.

v1.2.142026-05-07

  • Addedthe standard install-integrity banner on first Back Office visit after install.
  • Addedrequired-configuration warnings for missing or invalid GA4 Measurement ID.
  • Addednative module warning integration so merchants see "installed, configuration required" instead of a false all-green state.
  • Refreshed shared MPR admin, license, integrity, config and update packages.
  • Updatedthe live demo with a sample Measurement ID, debug mode and diagnostics-first test flow.

v1.2.02026-04-12

  • Reworked the module around GA4 ecommerce tracking with page_view, view_item, add_to_cart, remove_from_cart, view_cart, begin_checkout, search, sign_up, login and purchase events.
  • Addedserver-side Measurement Protocol purchase fallback for completed orders when enabled with a real API Secret.
  • Addeddiagnostics for hook order, Consent Mode, duplicate GA/GTM tags, live storefront HTML and recent server-side event attempts.
  • Addedcustomer-group repair and displayHeader hook-order repair tools.

v1.1.02026-02-21

  • Addedstandard MPR admin controllers for configuration, license, support, update and integrity.
  • AddedGoogle Consent Mode ordering support with Cookies Revolution.
  • Addedhashed User ID tracking option for logged-in customers.

v1.2.122025-10-19

  • Improvedupdate/download readiness for Digital Revolution releases.
  • Refreshed shared update package integration for remote module updates.
  • Hardened admin tab registration and first-visit infrastructure checks.

v1.2.112025-10-03

  • Addedone-click remote updates via the prestashop-update package.
  • AddedInfrastructureGuard self-heal with Symfony tab rescue.
  • Addedrequired-config modal support for GA4 integrity checks.
  • AddedEnhanced Conversions, Google Signals and Measurement Protocol validation fields.
  • Addedcomplete FR, DE, ES, IT and PL translations.

v1.0.02025-04-17

  • InitialGoogle Analytics 4 module for PrestaShop.
  • Addedconfigurable GA4 Measurement ID and gtag.js front-office bootstrap.
  • Addedenhanced ecommerce purchase payload with transaction ID, value, tax, shipping and item data.

Demo

Test the full module

  • Ready demo shop Explore a ready demo shop in your browser.
  • No registration No account, email or store domain needed.

By opening this demo you accept the demo terms and the privacy policy.

Loading...
Back to top