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)
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
- Create GTM Containers
- Provision GTM server container hosting
- Install and activate plugins
- Download and install all server-side GTM presets
- Download and install web GTM preset
- 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:
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:
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.
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.
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.