Available for projects & agency overflow · Quick reply, from the person who does the work

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.

Describe my issue Send a message

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 </head>, 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.

Related pages

Describe your need in one minute

A few targeted questions so I can reply with an estimate rather than another questionnaire.

outil
api
sens
frequence (optional)
How can I get back to you?

Please provide an email or a phone number so I can get back to you.

Frequently asked questions

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.
ALLAUX · AI ASSISTANT

Shall we talk?

PrestaShop

Opening the assistant…

A problem? An idea?

Describe what you need. Let’s find the next step.

Messages are sent to the AI provider and kept for 30 days by Allaux. Do not share secrets. Privacy