# Installing Google Tag Manager on a PrestaShop store

> Google Tag Manager on PrestaShop means a container added once to the theme, after which every tag, GA4, Ads, Meta, is managed from the GTM interface with no new deployment. The prerequisite I install alongside it is a data layer fed by PrestaShop, or GTM has nothing to read.

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

## Direct answer

> Create the container in Google Tag Manager, then place the first snippet through the displayHeader hook and the second through displayAfterBodyOpeningTag, rather than pasting code into themes//templates/. Next, have PrestaShop push product, cart and order variables into the dataLayer, otherwise the container has nothing to read. Check it all in Preview mode through to order-confirmation.

## The situations I handle

- You keep adding marketing tools and have to edit the theme every time
- GTM is installed but no tag fires correctly
- You’re not sure where to cleanly place the container’s two code snippets
- PrestaShop’s data layer is empty or incomplete on the cart and checkout
- Several people work on the site and the tracking code is duplicated in several places

## How I install GTM on PrestaShop

1. **Creating the GTM container** — I create the container in the Google Tag Manager interface, which generates two code snippets: one for the head, one for right after the body tag opens.
2. **Placing it in the PrestaShop theme** — I place the first snippet in the theme’s head.tpl file, just before the closing , and the second in the displayAfterBodyOpeningTag hook rather than hard-coded in a file copied onto every page.
3. **Building the data layer** — I have PrestaShop push product, cart and order variables (items, value, currency, transaction_id) at the right moment on the product page, cart and order-confirmation page, so GTM has data to read.
4. **Adding tags from the GTM interface** — Once the data layer is in place, I add GA4 and other marketing tags directly in GTM, without going back into the theme code.
5. **Testing in preview mode** — I check, page by page, which tags fire and with which data layer variables, before publishing the container to production.

## Why go through GTM instead of hard-coding every tag

Without a tag manager, every new marketing tool, a Meta pixel, a Google Ads tag, means editing the PrestaShop theme and clearing the cache. With GTM, a single container is added once, and every following tag is managed from the interface, with no new deployment.

The container alone isn’t enough: GTM reads a data layer, a JavaScript data layer that PrestaShop needs to feed with product, cart and order information at the right time. Without a structured data layer, the ecommerce tags set up in GTM have nothing to read, even if the container itself is installed correctly.

I prefer placing both code snippets through theme files and PrestaShop’s native hooks rather than hard-coded across several copied templates, to keep a single point of maintenance.

## One container, two locations

> The first GTM snippet goes in the head tag: that is the one that loads the container and makes everything work. The second, placed right after the body tag opens, is a noscript tag containing an iframe: it only runs when JavaScript is disabled in the browser, and then reports nothing but a page view, with no data layer and no ecommerce event. Its reach is therefore very limited, but Google ships it with the container and I put it in anyway.

## Related pages

- **Google Analytics 4 on PrestaShop** — The first tag to add once the GTM container is installed. ([/services/tracking/google-analytics-4-prestashop](/services/tracking/google-analytics-4-prestashop))
- **Duplicate stats: the causes** — What happens when a GTM container is installed twice on the same page. ([/services/tracking/doublons-statistiques-causes](/services/tracking/doublons-statistiques-causes))
- **Checking a tag’s install without paid tools** — Free tools to check a tag is actually firing. ([/services/tracking/verifier-installation-balise-sans-outil-payant](/services/tracking/verifier-installation-balise-sans-outil-payant))
- **PrestaShop, my main platform** — The other PrestaShop topics I deal with day to day. ([/prestashop](/prestashop))

## FAQ

### Does the GTM container replace Google Analytics 4?

No, GTM is a tag manager. GA4 is still the measurement tool: it’s set up as a tag inside the GTM container once that’s installed.

### Can I install GTM and gtag.js at the same time?

No: GA4 then gets loaded twice and every event is sent in duplicate. I pick one method or the other, never both on the same site.

### Do I need a PrestaShop module to install GTM?

A module can simplify placing the two code snippets, but I mostly work directly through theme files, to keep control over the exact location and avoid clashing with other tracking modules.

### How do I check PrestaShop’s data layer is properly fed?

Google Tag Manager’s preview mode shows the data layer’s content on every page as a tag fires, making it easy to spot straight away if a variable like value or transaction_id is empty.

### Do I need visitor consent before GTM fires tags?

GTM itself collects nothing: it’s the tags it fires, GA4, Ads, Meta, that are concerned. GA4, in its standard configuration, doesn’t meet the CNIL’s exemption criteria and therefore, in principle, requires the visitor’s prior consent.
