Custom Code in Head & Body

GA4, Pixels, Chat & GTM — installation and configuration guide · by Softnet Sistemas

1. What this module does

Custom Code inserts any third-party snippet (Google Analytics 4, Google Tag Manager, Meta/TikTok/Pinterest pixels, live-chat widgets, verification tags, custom CSS/JS) into the <head> or <body> of every page of your store — without editing a single template file, and safe from theme updates. Each snippet can be targeted by page type, device, language and visibility.

2. Requirements

3. Installation

  1. In your back office, go to Modules → Module Manager.
  2. Click Upload a module and select the module ZIP file (sncustomcode.zip).
  3. PrestaShop installs it automatically. When it finishes, click Configure.
The module registers three display hooks on install: displayHeader, displayAfterBodyOpeningTag and displayBeforeBodyClosingTag. No template edits are needed.

4. Adding your first snippet

  1. On the configuration screen, click Add snippet.
  2. Give it a clear Name (e.g. “GA4”, “Meta Pixel”, “Chat widget”).
  3. Choose the Position (see the table below).
  4. Paste your code in the editor. It is stored exactly as you paste it — script and meta tags are never stripped.
  5. Optionally set the targeting options (pages, device, language, visibility, priority).
  6. Make sure Enabled is ticked and click Save.
  7. Open your store and confirm the tag loads correctly.

Positions

PositionWhere it printsTypical use
HeadInside <head>GA4, Matomo, Clarity, verification meta tags, the script part of GTM
Body startRight after <body>The Google Tag Manager <noscript> snippet
Body endBefore </body>Chat widgets and non-critical scripts

5. Targeting options

6. Managing snippets

7. Uninstalling

Uninstalling the module from the Module Manager removes all snippets and the inserted code from your store pages. No residual data is left behind.

Tip: a badly closed script tag can break page rendering. After saving a snippet, open your store front office and check that pages load correctly.
Custom Code in Head & Body · Softnet Sistemas SL · Support: support@aiprocessia.com
This module is actively maintained and compatible with PrestaShop 1.7 through 9.