PS PrestaShop Intermediate

Google Tag Pro (GTM & GA4) — Complete guide

Install, configure and run Google Tag Pro: GTM container, GA4 Enhanced Ecommerce, Consent Mode v2, Enhanced Conversions, Google Ads conversions, pixels, Server-side GTM, Conversion Recovery and troubleshooting for PrestaShop 8 and 9.

Updated Module version 1.2.0

Google Tag Pro (the dfgtagmanager module) installs complete, reliable e-commerce tracking on your store: 16 GA4 Enhanced Ecommerce events, Consent Mode v2, Enhanced Conversions, Google Ads conversion tracking, advertising pixels, Server-side GTM and a Conversion Recovery system that replays lost conversions. This guide covers installation, every configuration section and troubleshooting.

Requirements

  • PrestaShop 8.0 to 9.0 (PHP 8.1 to 8.4 recommended).
  • A Google Tag Manager account with a Web container (ID in the GTM-XXXXXXX format).
  • A Google Analytics 4 property (measurement ID in the G-XXXXXXXXXX format).
  • Optional: a Google Ads account (conversion ID AW-XXXXXXXXX), Google Merchant Center, and/or an sGTM server.

Installation

  1. In the back office, go to Modules > Module Manager, click Upload a module and select the dfgtagmanager.zip file.
  2. Once installed, click Configure.
  3. The module creates its tables (conversion and event logs) and registers its hooks automatically.

The module is multistore-compatible: each store keeps its own GTM container, GA4 ID, pixels and consent settings. Configure each context from the store selector at the top of the page.

1. Google Tag Manager configuration

In the Google Tag Manager – Configuration section:

  • Enable GTM: activates container injection on the front office.
  • GTM Container ID: your GTM-XXXXXXX identifier. While empty, the module injects nothing.
  • GA4 Measurement ID: your G-XXXXXXXXXX identifier. It is used to pre-fill the GA4 tag in the container export.

The module pushes data into the dataLayer before GTM loads, so all your tags immediately have the page and e-commerce data available.

2. Tracking events (GA4 Enhanced Ecommerce)

Once enabled, the module automatically sends up to 16 events compliant with the official GA4 schema:

  • Discovery: view_item, view_item_list, select_item
  • Cart & checkout: add_to_cart, remove_from_cart, view_cart, begin_checkout, add_shipping_info, add_payment_info
  • Conversion: purchase (with items[], value, tax, shipping, coupon, transaction_id)
  • User & marketing: login, sign_up, search, add_to_wishlist, view_promotion, select_promotion

Cart, checkout, promotion and search events fire client-side (AJAX interception and IntersectionObserver); the purchase event is built server-side at order confirmation.

Since version 1.2.0, the search event is emitted client-side to stay compatible with PrestaShop 9.1, where the displaySearch hook is deprecated. No action is required on your side.

Related settings in the Tracking events section: enable/disable GA4 Enhanced Ecommerce, user data (user_data), internal search, login, sign-up, promotions, wishlist and dynamic remarketing.

Consent Mode v2 has been mandatory since March 2024 to measure Google conversions in the EEA. In the Consent Mode v2 section:

  • Enable Consent Mode v2: injects the default consent values before GTM.
  • Default analytics_storage / ad_storage: leave on Denied (GDPR-recommended); consent will be updated by your banner.

The module also enables url_passthrough and ads_data_redaction to maximise conversion modelling when consent is absent.

When the visitor accepts or declines, call the function provided by the module from your CMP (Tarteaucitron, Axeptio, Cookiebot, etc.):

DFGTM.updateConsent({
  analytics_storage: 'granted',
  ad_storage: 'granted',
  ad_user_data: 'granted',
  ad_personalization: 'granted'
});

If you never call updateConsent(), consent stays on the default values (denied) and you will only collect modelled data. Make sure to connect your CMP.

4. Enhanced Conversions

When enabled, Enhanced Conversions improve Google Ads attribution. The module hashes customer data (email, name, phone, city) server-side in SHA-256 and transmits it via the dataLayer. Data is never transmitted in plain text; postal code and country are sent unhashed, as per Google’s specifications.

5. Google Ads conversions & Merchant Center

In the Google Ads – Conversion tracking section:

  • Enable Google Ads Conversion: adds the Conversion Linker, the purchase conversion tag and dynamic remarketing to the GTM export.
  • Conversion ID: your AW-XXXXXXXXX identifier.
  • Conversion Label (Purchase): the “Purchase” conversion label (alphanumeric string).
  • Merchant Center ID + feed country and language: required for “conversions with cart data”.
  • Product ID source: choose the format matching the id field of your Merchant Center feed (ID + separator + combination, reference/SKU, ID only, EAN13, UPC or MPN).

The product ID source must exactly match the ID used in your Merchant Center feed, otherwise conversions with cart data won’t be reported. When in doubt, use the same source as your product feed module.

6. Advertising pixels (Meta, TikTok, Pinterest)

In the Advertising pixels section, enter your Facebook/Meta, TikTok and Pinterest IDs. They are integrated into the GTM container export with e-commerce events mapped automatically (Purchase, AddToCart, ViewContent, InitiateCheckout, Search / CompletePayment / checkout depending on the platform).

7. GTM container export

Rather than manually creating dozens of tags, the module generates a ready-to-import container:

  1. In the GTM container export section, click Export the GTM container (JSON).
  2. In Google Tag Manager, go to Admin > Import Container.
  3. Select the JSON file, choose a workspace, and the Merge option (or Overwrite on an empty container).
  4. Review the preview, then Publish your container.

The export contains the GA4 Configuration tag and all Enhanced Ecommerce events, DataLayer variables, Custom Event triggers, Consent Mode v2, plus the enabled Google Ads tags and pixels.

Regenerate and re-import the export after changing your IDs (GA4, Google Ads, pixels) so the container reflects your new settings.

8. Server-Side GTM (sGTM)

In the Server-Side GTM section, enable the option and enter your server URL (e.g. https://sgtm.your-domain.com). The module then loads the GTM script and noscript from your server instead of googletagmanager.com, which bypasses ad-blockers and improves tracking reliability.

9. Conversion Recovery

This is the module’s key feature. At each order confirmation, the conversion is saved to the database. An asynchronous check verifies that GTM received the purchase event; if not (ad-blocker, payment redirect, network error), the event is replayed automatically on the customer’s next visit. No configuration is required; leave the option enabled in Advanced options.

10. Advanced options

  • Cross-domain tracking: list the relevant domains (comma-separated).
  • Exclude tax / shipping from revenue: adjusts the value calculation for purchase.
  • Debug mode: logs each dataLayer push in the browser console (coloured “DataFirefly GTM” prefix). Disable in production.

11. Monitoring dashboard

At the top of the configuration page, a dashboard shows over 30 days: the number of tracked conversions, those pushed successfully, those pending recovery, tracked revenue, the tracking success rate and the top events over 7 days. A Replay button re-flags failed conversions for another attempt.

Aim for a tracking rate > 95%. Below 80%, enable Server-Side GTM to bypass ad-blockers.

PrestaShop 9 compatibility

Since version 1.2.0, the module is compatible with PrestaShop 8 and 9 (Symfony 6.4, PHP 8.1 to 8.4). Price formatting goes through the Locale (the old Tools::displayPrice method was removed from PS9), search tracking is client-side, and both sessions and the export download were hardened for the Symfony kernel. No action is required when upgrading; the upgrade script cleans up obsolete hooks automatically.

Troubleshooting

No data reaches GTM / GA4

Check that Enable GTM is ticked and the container ID is filled in. The module injects nothing until both conditions are met. Use GTM Preview and the module’s debug mode to see the dataLayer pushes.

Make sure you imported and published the exported container after entering the conversion ID and label. Check the AW-XXXXXXXXX format and the purchase label.

Cart data (Merchant Center) is missing

Fill in the Merchant Center ID, feed country and language, and check that the product ID source matches the id field of your feed.

Connect your CMP by calling DFGTM.updateConsent() on acceptance. Without this call, only modelled data is collected.

The export file is empty or corrupted

Temporarily disable HTML cache/optimisation modules and try again; the export clears output buffers but a third-party module may inject content before the download.

Was this page helpful?

Still stuck? Contact support