Google Analytics GA4: setup and help
Quick start
- Upload the
mprgoogleanalyticsZIP through Modules > Module Manager > Upload a module. - Click Configure and enter your GA4 Measurement ID, starting with
G-followed by at least six uppercase letters or digits. - Keep Enable Tracking on and review Exclude Employees, User ID Tracking, Enhanced Conversions and Google Signals.
- 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.
- Save, then open Diagnostics and run its checks. Repair hook order or module group visibility if indicated.
- 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.
- 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.
Configure consent and traffic exclusions
When Cookies Revolution is active, the module detects it and can move itself last on displayHeader so the CMP initializes Consent Mode first. Use Repair hook order in Diagnostics if needed.
Without that detected CMP, the module emits Consent Mode defaults denying analytics, advertising, ad user data and personalization storage, while security storage is granted. This is a default snippet. It does not create a banner or obtain a consent grant. Configure consent updates through your consent tool.
The browser eligibility gate skips non-front controllers, recognized bots/audit tools, excluded employees and a browser with mpr_notrack=1. To opt out a test browser:
document.cookie = 'mpr_notrack=1; path=/; max-age=31536000; SameSite=Lax';
Server purchases require the buyer’s captured analytics consent, original GA client and session IDs, and permission for this module to send to the configured GA4 property. Browser opt-outs and employee exclusions also apply. Server-Side Purchase Fallback is off by default. To enable it, enter valid credentials and set Purchase recovery hostname to your production shop’s HTTPS hostname, without a scheme or path.
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.




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
Staff exclusions were not applied on every tracking path
Saving settings could clear an existing API secret
Diagnostics did not report purchase delivery failures
Credential could not be saved from installation checks
Available translations were not displayed
Module failed to load on PHP 7.1
Incorrect translations appeared in the interface
Combined storefront assets could break tracking
Feature Requests
16
Implemented
GA4 ecommerce events, diagnostics and purchase event recovery
GA4 ecommerce tracking
Custom GA4 event rules
Queued server-side purchase delivery
Demonstration event monitor
Enhanced Conversions
Google Signals setting
Event log retention
Back-office module updates
Installation health dashboard
Additional administration languages
Product engagement tracking
GA4 tracking ownership coordination
Contact interaction tracking
Missing purchase recovery
Confirmed cart tracking
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.