How to integrate GA4 with WooCommerce server-side?

This is a preset for GTM Server container that forwards events sent from the web container to GA4. Make sure you have installed two following presets before:

How to serve GTM Web container from Server container?

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


You can install all of them at the same time in preview mode but don't publish this preset without publishing those listed above.


1. Download & Import the preset

Open WP Admin and navigate to Settings and Google Tag Manager. Then select GTM Server Presets tab which contains presets for server containers:

Then import the file in your GTM Web Container according to this guide.

2. Set variables

Once you have imported the preset into your GTM Server Container you need to set value for variable called GA4 Measurement ID.

Head to GTM Workspace and click Variables on the left, then find that variable. The value should be set to measurement ID of the GA4 instance that you want to connect. In case of migrating existing setup you it can have the same value as the main GA4 Measurement ID from your existing GTM Web Container.

3. Preview and publish

Once the variable is configured you can run GTM preview to ensure correct operations and publish the new version of the container whenever ready.

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