How to setup complete GTM server-side setup for WooCommerce?

Deploying GTM Server Container can bring a number of benefits to eCommerce tracking performance, including but not limited to:

  • quicker page loading times (one web tag can be forwarded to multiple destination tools by the server tags)
  • better privacy control (server container gives precise information what is being sent by each tag and what cookies are set in response)
  • more durable cookies (server driven 1st party cookies are the most reliable way of storing user information minimising risk of browser blocking or removing it)
  • 100% conversions coverage with server-to-server webhooks (server-side tracking allows to capture 100% of transactions. Even without user consent anonymous event can still be tracked)

Steps overview

Getting everything complete is multi-step process so we will start with quick overview of those steps before we jump into details. In a nutshell this is what we need to do

  1. Create GTM Containers
  2. Provision GTM server container hosting
  3. Install and activate plugins
  4. Download and install all server-side GTM presets
  5. Download and install web GTM preset
  6. Preview and publish

Okay so let's start:

1. Create GTM Containers

First, make sure that you have two GTM workspaces ready for your project. You need one classic web container and one server container:

Have those two GTM containers ready before next steps.

2. Provision GTM Server Container hosting

This step is about provisioning GTM Server Container. In contrast to the classic Web Container that is served directly from Google public APIs Server Container needs to be hosted independently.

Follow this guide to complete the step:

How to setup GTM Server Container Hosting?


3. Install and activate plugins

If you have not done that yet make sure you have installed both Google Tag Manager for WooCommerce PRO and the Advanced Server-side Add-on to have access to all required features and GTM presets:

How to install and activate the WooCommerce plugin?

How to install Advanced Server-Side add-on for Google Tag Manager for WooCommerce?


4. Download and install all Server GTM presets

In your WP Admin navigate to Settings and Google Tag Manager then click "GTM Server Presets" tab.

Download and import all relevant presets.

It is important to configure and later publish GTM Server Container before Web Container, otherwise data may be lost.

How to serve GTM Web container from Server container?

How to integrate GA4 with WooCommerce server-side?

How to integrate Facebook Conversions API server-side for WooCommerce?

How to measure WooCommerce conversions with server-side Google Ads?


5. Download and install Web GTM preset

Once the server container is prepared, it is time to configure Web Container to talk to Server Container.

This mean downloading and installing one Web GTM Preset called "Google Tag to Server".

If existing Web only setup is being migrated to Server enabled one and there are existing tags in the Web Container carefully review which of those should be paused or removed before going live.

How to send events to GTM server container with Google Tags Preset?

6. Preview and publish

Now all the items are in place its time to run preview mode first in server container, then web container.

If all events are tracked and all fired tags return success response you are ready to publish new versions of both containers.

First publish server container and only after that the web container.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.