# Installing Google Analytics 4 on a PrestaShop store

> There are two ways to add Google Analytics 4 to PrestaShop: the gtag.js tag pasted straight into the theme, or a Google Tag Manager container, which I use by default so I don’t have to touch the code every time something changes. Either way, what breaks ecommerce tracking is a purchase event that isn’t filled in properly on the order confirmation page.

- Source canonique : [https://allaux.fr/en/services/tracking/google-analytics-4-prestashop](https://allaux.fr/en/services/tracking/google-analytics-4-prestashop)
- Langue : EN
- Dernière mise à jour : 2026-09-30

## Direct answer

> Before installing anything, open Modules > Module Manager and check that no module is already sending data to Google Analytics. Then attach the tag or container through the displayHeader hook rather than hard-coding it into a theme template, and populate transaction_id, value, currency and items on the order-confirmation page. Confirm the purchase arrives in DebugView.

## The situations I handle

- No ecommerce data reaching GA4 despite a tag visible in the page source
- A PrestaShop module already sends data to Google Analytics and you want to add GA4 without duplicating it
- GA4 reports show page views but no purchases
- You’re not sure whether to hard-code gtag.js in the theme or use Google Tag Manager
- The number of transactions in GA4 never matches the real number of PrestaShop orders

## How I install GA4 on PrestaShop

1. **Choosing the installation method** — I add either the gtag.js tag directly in header.tpl or via a hook such as displayHeader, or a Google Tag Manager container that calls GA4 from its interface. I use GTM by default: future changes don’t require touching the theme again.
2. **Checking for an existing tag** — Before adding anything, I check the page source and the list of installed modules under Modules > Module Manager to make sure no third-party module is already sending data to Google Analytics.
3. **Checking the data layer on key pages** — I check that view_item, add_to_cart and begin_checkout fire with the right parameters (items, value, currency) on the product page, the cart and the checkout.
4. **Configuring the purchase event** — On PrestaShop’s order-confirmation page, I make sure transaction_id (the order ID) and value (the amount actually paid) are passed correctly, otherwise GA4 records a visit with no usable transaction.
5. **Testing before going live** — I check every event fires correctly in Google Tag Manager’s preview mode, or with the Tag Assistant extension if the tag is hard-coded, against a test order.

## The two methods, and why I favour GTM

The gtag.js tag can be pasted straight into the PrestaShop theme, usually in header.tpl or via a hook such as displayHeader. That works, but every change, adding an advertising tool or editing an event, means touching the code and clearing the Smarty cache.

Using Google Tag Manager means adding a single container once, then managing GA4 and other tags from the GTM interface, with no new deployment for each change. Google recommends this approach for sites whose tracking is likely to evolve.

GA4’s recommended ecommerce events, view_item, add_to_cart, begin_checkout, purchase among others, have names and parameters set by Google: following them exactly is necessary for GA4’s standard ecommerce reports to work.

## The duplication trap

> If a PrestaShop module already sends data to Google Analytics and you add GA4 on top of it, hard-coded in the theme, the same visit or the same order can be counted twice. I always check the installed and enabled modules under Modules > Module Manager before any manual install.

## Related pages

- **Google Tag Manager on PrestaShop** — The method I recommend for centralising GA4 and other tags without touching the theme every time. ([/services/tracking/google-tag-manager-prestashop](/services/tracking/google-tag-manager-prestashop))
- **Ecommerce events that matter** — The GA4 events worth tracking first on a purchase funnel. ([/services/tracking/evenements-ecommerce-qui-comptent](/services/tracking/evenements-ecommerce-qui-comptent))
- **Conversions not showing up** — The diagnostic method when purchases don’t appear in GA4 despite a tag being installed. ([/services/tracking/conversions-ne-remontent-pas](/services/tracking/conversions-ne-remontent-pas))
- **PrestaShop, my main platform** — The other PrestaShop topics I deal with day to day. ([/prestashop](/prestashop))

## FAQ

### Do I have to use Google Tag Manager, or is hard-coded gtag.js enough?

Hard-coded gtag.js works fine for a simple install. I’d avoid it as soon as the site plans to add Google Ads, Meta or another tool: GTM saves you touching the theme every time.

### Does Google Analytics 4 replace Universal Analytics?

Yes. Universal Analytics has stopped collecting data since July 2023. If an old PrestaShop module still points to it, nothing gets recorded any more.

### Do I need visitor consent before loading GA4?

GA4, in its standard configuration, doesn’t meet the CNIL’s exemption criteria for audience measurement tools. Loading it therefore, in principle, requires the visitor’s prior consent, like any non-exempt tracker.

### How do I check my ecommerce events are configured correctly?

Google Tag Manager’s preview mode or GA4’s DebugView show, in real time, which events fire and with what parameters, page by page, during a test order.

### Is a free PrestaShop tracking module enough on its own?

Some modules add a basic GA4 tag without full ecommerce events. I always check what a module actually sends before relying on it or adding to it.
