E-commerce platform

Server-Side Tracking for PrestaShop

Stop losing conversions to iOS ITP, short-lived cookies, and ad-blockers. TrakSolv hosts a first-party server-side GTM container for your PrestaShop store and forwards clean, deduplicated conversions to GA4, Meta CAPI, Google Ads and more. Live in minutes, flat monthly pricing.

No credit card to startFlat monthly pricingNative PrestaShop dataLayerGA4 · Meta CAPI · Google Ads
Why it matters for PrestaShop

The pixel alone is leaking your data.

Browser-side tracking on PrestaShop loses a growing share of conversions. Here's what moving to a server-side setup fixes.

Recover conversions lost to ITP & ad-blockers

On PrestaShop, browser-side pixels are throttled by Safari/Firefox ITP, capped 7-day cookies, and blocked outright by ad-blockers and consent walls. Server-side tracking moves the measurement off the browser, so purchases and add-to-carts that the pixel silently drops are recovered and reported.

First-party data, served from your own domain

TrakSolv hosts your Google Tag Manager server container on a subdomain of your PrestaShop site. Requests come from a first-party context — they survive 3rd-party cookie deprecation, last far longer than client-side cookies, and look like your own traffic, not a tracker.

Clean, deduplicated conversions to every ad platform

The PrestaShop dataLayer fires every GA4 enhanced-ecommerce event with a stable event_id, so your server-side container can forward purchases and add-to-carts to GA4, Meta CAPI, Google Ads Enhanced Conversions, TikTok and more — deduplicated against the browser pixel, with higher match quality.

Step by step

How to set up server-side tracking on PrestaShop

Paste the TrakSolv loader and the PrestaShop dataLayer snippet into your store's custom-code area, save, and you're done. Every step below has the exact snippet with a copy button.

Install guide

How to install on PrestaShop

This is your install. Every step below has its exact snippet with a Copy button — go step by step. The Loader card above and DataLayer card below are reference copies of the same snippets.

  1. 1

    Open your theme's Custom JS

    Navigate

    PrestaShop BackOffice → Design → Theme & Logo → Theme Customization

    Most modern themes have a 'Custom JavaScript' or 'Header / Footer Scripts' field. If yours doesn't, install a free 'JS Manager' module from the Marketplace, OR edit the theme's templates/_partials/footer.tpl directly.

  2. 2

    Loader — head half

    Loader • Head

    Custom JS (header position) → paste the Loader Head snippet

  3. 3

    Loader — body half + DataLayer

    Loader • Body

    Custom JS (footer position) → paste the Loader Body snippet FIRST

  4. 4

    DataLayer snippet

    DataLayer

    Same footer position → append the DataLayer snippet after the Body

    The DataLayer uses prestashop.on('updateCart') for live cart events + the typed prestashop.product / .cart / .order objects.

    HTML
    <!-- Traksolv · PrestaShop DataLayer — paste in your theme custom JS / footer.tpl -->
    <script>
    (function (w, d) {
      w.dataLayer = w.dataLayer || [];
      var DEBUG = false;
      try {
        var q = new URLSearchParams(location.search);
        if (q.get('tcDebug') === '1') { DEBUG = true; try { localStorage.setItem('tcDebug', '1'); } catch (e) {} }
        else if (q.get('tcDebug') === '0') { DEBUG = false; try { localStorage.removeItem('tcDebug'); } catch (e) {} }
        else { try { if (localStorage.getItem('tcDebug') === '1') DEBUG = true; } catch (e) {} }
      } catch (e) {}
      w.tcDebug = DEBUG;
      if (DEBUG && w.console && w.console.log) {
        try { w.console.log('%c[Traksolv]%c dataLayer debug ON — every push will log here. Disable with ?tcDebug=0', 'color:#22c55e;font-weight:600;background:#0a1f0c;padding:2px 6px;border-radius:3px', ''); } catch (e) {}
      }
      function log() {
        if (!DEBUG || !w.console || !w.console.log) return;
        try { w.console.log.apply(w.console, ['[Traksolv]'].concat([].slice.call(arguments))); } catch (e) {}
      }
      function push(eventName, eventId, params) {
        try {
          if (params && params.ecommerce !== undefined) w.dataLayer.push({ ecommerce: null });
          var ev = { event: eventName, event_id: eventName + '.' + eventId };
          if (params) for (var k in params) if (Object.prototype.hasOwnProperty.call(params, k)) ev[k] = params[k];
          w.dataLayer.push(ev);
          log('push ' + eventName, ev);
        } catch (e) {}
      }
      function once(key) {
        try { if (sessionStorage.getItem(key)) return false; sessionStorage.setItem(key, '1'); return true; }
        catch (e) { return true; }
      }
      function money(v) { return parseFloat(String(v == null ? '' : v).replace(/[^\d.\-]/g, '')) || 0; }
    
      w.tcFirePurchase = function (o) {
        try {
          if (!o || !o.orderId) return;
          if (!once('tc_purchase_' + o.orderId)) return;
          var ps = w.prestashop || {};
          push('purchase', String(o.orderId), {
            ecommerce: {
              transaction_id: String(o.orderId),
              value:    o.value || 0,
              currency: o.currency || (ps.currency && ps.currency.iso_code) || 'EUR',
              items:    Array.isArray(o.items) ? o.items : []
            }
          });
        } catch (e) {}
      };
    
      function ps() { return w.prestashop || {}; }
      function pageName() {
        var p = ps().page;
        return (p && (p.page_name || p.body_classes && p.body_classes[0])) || '';
      }
      function pageType() {
        var n = pageName();
        if (/^order-confirmation/.test(n) || /\/order-confirmation/.test(location.pathname)) return 'order';
        if (/^order/.test(n) || /\/order/.test(location.pathname)) return 'checkout';
        if (/^cart/.test(n) || /\/cart/.test(location.pathname)) return 'cart';
        if (/^product/.test(n)) return 'product';
        if (/^category|manufacturer|supplier/.test(n)) return 'category';
        return 'other';
      }
      w.tcPageType = pageType;
    
      function currency() {
        var p = ps();
        return (p.currency && p.currency.iso_code) || 'EUR';
      }
    
      function fireViewItem() {
        try {
          var prod = ps().product;
          if (!prod || !prod.id_product) return;
          if (!once('tc_view_item_' + prod.id_product)) return;
          push('view_item', String(prod.id_product), {
            ecommerce: {
              currency: currency(),
              value:    money(prod.price_amount || prod.price),
              items: [{
                item_id:       String(prod.id_product),
                item_name:     prod.name,
                item_brand:    prod.manufacturer_name,
                item_category: prod.category_name,
                price:         money(prod.price_amount || prod.price),
                quantity:      1
              }]
            }
          });
        } catch (e) {}
      }
    
      function fireViewItemList() {
        try {
          var products = ps().listing && ps().listing.products;
          if (!products || !products.length) return;
          if (!once('tc_view_item_list_' + location.pathname)) return;
          push('view_item_list', location.pathname, {
            ecommerce: {
              item_list_id:   location.pathname,
              item_list_name: (d.querySelector('h1') || {}).textContent || location.pathname,
              items: products.slice(0, 25).map(function (p, i) {
                return {
                  item_id:   String(p.id_product),
                  item_name: p.name,
                  price:     money(p.price_amount || p.price),
                  index:     i
                };
              })
            }
          });
        } catch (e) {}
      }
    
      function fireCart(eventName) {
        try {
          var c = ps().cart;
          if (!c || !c.products) return;
          var cartId = String(c.id || 'cart');
          if (!once('tc_' + eventName + '_' + cartId)) return;
          var items = (c.products || []).map(function (p) {
            return {
              item_id:   String(p.id_product),
              item_name: p.name,
              price:     money(p.price_amount || p.price),
              quantity:  p.cart_quantity || p.quantity || 1
            };
          });
          push(eventName, cartId, {
            ecommerce: {
              currency: currency(),
              value:    money(c.totals && (c.totals.total && c.totals.total.amount)),
              items:    items
            }
          });
        } catch (e) {}
      }
    
      function firePurchase() {
        try {
          // PrestaShop's order-confirmation page exposes order data via DOM
          // + window.prestashop.order (some themes). Try both.
          var order = ps().order;
          var orderId = (order && (order.id_order || order.reference)) ||
                        (location.search.match(/id_order=(\d+)/) || [])[1];
          if (!orderId) return;
          if (!once('tc_purchase_' + orderId)) return;
          var revenue = (order && order.total_paid) ||
                        money((d.querySelector('.total-value, #total-value, .order-total') || {}).textContent);
          push('purchase', String(orderId), {
            ecommerce: {
              transaction_id: String(orderId),
              value:    money(revenue),
              currency: currency(),
              items:    (order && order.products ? order.products : []).map(function (p) {
                return {
                  item_id:   String(p.id_product || p.product_id),
                  item_name: p.name,
                  price:     money(p.price || p.unit_price_tax_incl),
                  quantity:  p.quantity || p.product_quantity || 1
                };
              })
            }
          });
        } catch (e) {}
      }
    
      // ── Hook the PrestaShop event bus for live cart changes ─────────
      function attachCartHooks() {
        try {
          if (!w.prestashop || typeof w.prestashop.on !== 'function') return;
          // updateCart fires after add/remove/update — re-read the cart.
          w.prestashop.on('updateCart', function (e) {
            try {
              var reason = e && e.reason && e.reason.linkAction;
              var c = ps().cart;
              if (!c || !c.products) return;
              var last = c.products[c.products.length - 1];
              if (reason === 'add-to-cart' && last) {
                push('add_to_cart', last.id_product + '.' + Date.now(), {
                  ecommerce: {
                    currency: currency(),
                    value:    money(last.price_amount || last.price) * (last.cart_quantity || 1),
                    items: [{
                      item_id:   String(last.id_product),
                      item_name: last.name,
                      price:     money(last.price_amount || last.price),
                      quantity:  last.cart_quantity || 1
                    }]
                  }
                });
              } else if (reason === 'delete-from-cart' || reason === 'remove-from-cart') {
                push('remove_from_cart', 'cart.' + Date.now(), {
                  ecommerce: { currency: currency(), value: 0, items: [] }
                });
              }
            } catch (e) {}
          });
        } catch (e) {}
      }
    
      function boot() {
        var t = pageType();
        if (t === 'product')  fireViewItem();
        if (t === 'category') fireViewItemList();
        if (t === 'cart')     fireCart('view_cart');
        if (t === 'checkout') fireCart('begin_checkout');
        if (t === 'order')    firePurchase();
        attachCartHooks();
      }
      if (d.readyState === 'loading') d.addEventListener('DOMContentLoaded', boot);
      else boot();
    })(window, document);
    </script>
    <!-- End Traksolv PrestaShop DataLayer -->
    
    <!-- Traksolv · DataLayer enrichment — customer lifecycle + remarketing + attribution -->
    <script>
    (function (w, d) {
      function readLT() {
        try {
          var raw = localStorage.getItem('tc_lifetime');
          var p = raw ? JSON.parse(raw) : null;
          return {
            orderCount:    (p && p.orderCount)    || 0,
            lifetimeValue: (p && p.lifetimeValue) || 0,
            firstOrderTs:  (p && p.firstOrderTs)  || null,
            lastOrderTs:   (p && p.lastOrderTs)   || null,
            lastOrderId:   (p && p.lastOrderId)   || null
          };
        } catch (e) {
          return { orderCount: 0, lifetimeValue: 0, firstOrderTs: null, lastOrderTs: null, lastOrderId: null };
        }
      }
      function writeLT(lt) {
        try { localStorage.setItem('tc_lifetime', JSON.stringify(lt)); } catch (e) {}
      }
      function tier(v) {
        if (v >= 1000) return 'vip';
        if (v >= 250)  return 'mid';
        if (v > 0)     return 'low';
        return 'guest';
      }
      function readCookie(n) {
        try {
          var m = d.cookie.match(new RegExp('(^|; )' + n + '=([^;]+)'));
          return m ? decodeURIComponent(m[2]) : null;
        } catch (e) { return null; }
      }
      function readAttr() {
        try { var r = readCookie('_tc_attr'); return r ? JSON.parse(r) : null; } catch (e) { return null; }
      }
    
      w.tcReadLifetime    = readLT;
      w.tcCustomerTier    = function (v) { return tier(v != null ? v : readLT().lifetimeValue); };
      w.tcReadAttribution = readAttr;
    
      // ── Wrap tcFirePurchase to add customer-lifecycle + attribution ──
      // before the underlying snippet pushes the purchase event. Idempotent
      // per orderId, so customer refreshing the thank-you page doesn't
      // inflate their lifetime counters.
      var orig = w.tcFirePurchase;
      if (typeof orig === 'function') {
        w.tcFirePurchase = function (o) {
          try {
            if (!o || !o.orderId) return orig.apply(this, arguments);
            var lt = readLT();
            var firstFire = lt.lastOrderId !== String(o.orderId);
            var orderCount    = firstFire ? lt.orderCount + 1 : lt.orderCount;
            var lifetimeValue = firstFire ? lt.lifetimeValue + (o.value || 0) : lt.lifetimeValue;
            var firstOrderTs  = lt.firstOrderTs || Date.now();
            var newCustomer   = orderCount === 1;
            var daysSinceFirst = Math.floor((Date.now() - firstOrderTs) / 86400000);
    
            if (firstFire) {
              writeLT({
                orderCount:    orderCount,
                lifetimeValue: lifetimeValue,
                firstOrderTs:  firstOrderTs,
                lastOrderTs:   Date.now(),
                lastOrderId:   String(o.orderId)
              });
            }
    
            var attr = readAttr();
            // Build the enriched order. Preserve every original field; add
            // customer + attribution on top.
            var enriched = {};
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) enriched[k] = o[k];
            enriched.new_customer            = newCustomer;
            enriched.customer_type           = newCustomer ? 'new' : 'returning';
            enriched.customer_status         = 'customer';
            enriched.customer_lifetime_value = Math.round(lifetimeValue * 100) / 100;
            enriched.customer_order_count    = orderCount;
            enriched.customer_aov            = orderCount > 0 ? Math.round((lifetimeValue / orderCount) * 100) / 100 : 0;
            enriched.purchase_number         = orderCount;
            enriched.days_since_first_order  = daysSinceFirst;
            enriched.value_tier              = tier(lifetimeValue);
            if (attr) enriched.attribution = {
              landing:   attr.u   || null,
              referrer:  attr.r   || null,
              utm:       attr.utm || null,
              click_ids: attr.cid || null
            };
            return orig.call(this, enriched);
          } catch (e) {
            try { return orig.apply(this, arguments); } catch (e2) {}
          }
        };
      }
    
      // ── tc_visitor_context — emits visitor lifecycle + remarketing on
      //    every page-view. GTM / GA4 audience triggers + Google Ads
      //    dynamic remarketing tag read these.
      function visitorContext() {
        try {
          var lt = readLT();
          var attr = readAttr();
          var pageType = (typeof w.tcPageType === 'function') ? (w.tcPageType() || 'other') : 'other';
          w.dataLayer = w.dataLayer || [];
          w.dataLayer.push({
            event:                   'tc_visitor_context',
            event_id:                'tc_visitor_context.' + Date.now() + '.' + Math.random().toString(36).slice(2, 6),
            customer_status:         lt.orderCount > 0 ? 'returning_customer' : 'guest',
            customer_type:           lt.orderCount > 0 ? 'returning' : 'guest',
            value_tier:              tier(lt.lifetimeValue),
            customer_lifetime_value: Math.round(lt.lifetimeValue * 100) / 100,
            customer_order_count:    lt.orderCount,
            days_since_first_order:  lt.firstOrderTs ? Math.floor((Date.now() - lt.firstOrderTs) / 86400000) : null,
            ecomm_pagetype:          pageType,
            attribution: attr ? {
              landing:   attr.u   || null,
              referrer:  attr.r   || null,
              utm:       attr.utm || null,
              click_ids: attr.cid || null
            } : null
          });
        } catch (e) {}
      }
      if (d.readyState === 'loading') d.addEventListener('DOMContentLoaded', visitorContext);
      else visitorContext();
    })(window, document);
    </script>
    <!-- End Traksolv enrichment -->
  5. 5

    Save and clear PrestaShop cache

    Save

    Save → BackOffice → Advanced Parameters → Performance → Clear cache

    PrestaShop aggressively caches the footer template — without clearing the cache the snippets won't render on the storefront.

The loader Head + Body snippets are generated for your container inside the TrakSolv dashboard. Create a free account to grab them, or see the full how-it-works walkthrough.

FAQ

Server-side tracking for PrestaShop, answered

Does server-side tracking work with PrestaShop?

Yes. TrakSolv works with PrestaShop via a lightweight loader snippet plus a PrestaShop-specific dataLayer that fires every GA4 enhanced-ecommerce event. You paste it once in PrestaShop's custom-code area and conversions start flowing through your own server-side GTM container.

How do I install TrakSolv on PrestaShop?

Add the TrakSolv loader (head + body) and the PrestaShop dataLayer snippet to your store's custom-code settings, then save. The full step-by-step is on this page. Most PrestaShop merchants are live in a few minutes — no developer required.

What can I track server-side on PrestaShop?

Page views, product views, purchases and add-to-carts, begin-checkout and more — every standard GA4 enhanced-ecommerce event, forwarded server-side to GA4, Meta CAPI, Google Ads and other destinations with deduplication.

How much does server-side tracking for PrestaShop cost?

TrakSolv uses flat monthly pricing — one event sent to many destinations still counts as one event, and paid plans never auto-pause at quota. You can start free and go live in minutes.

Recover your PrestaShop conversions — start free.

Spin up a first-party server-side GTM container for PrestaShop and watch your match quality climb. No credit card, live in minutes.

WhatsApp
Server-Side Tracking for PrestaShop — TrakSolv | Traksolv