How to integrate Google Analytics GA4 with WooCommerce?
End-to-end guide on enabling GA4 for WooCommerce.
GA4 is the name of a new type of Google Analytics property that comes with a new UI and features to analyze customers' behavior in an eCommerce shop. This guide shows how to integrate WooCommerce shop with GA4 using Google Tag Manager for WooCommerce PRO or FREE plugin (please note that FREE will only cover two eCommerce events).
1. Install and configure Google Tag Manager for WooCommerce plugin
First, make sure that Google Tag Manager for WooCommerce PRO or FREE plugin is up and live in your WooCommerce shop.
Please check our reference to see what are the differences between PRO and FREE version.
2. Prepare Google Analytics GA4 property
Next prepare a new or existing GA4 property and obtain the GA4 Measurement ID.
Go to your GA4 property, click the gear icon in the bottom left, and select
Data Streams. If you haven't done that before you will need to create a new Web stream. Once you have selected the correct stream, copy the Measurement ID.
3. Download GA4 preset
After that, navigate back to your WordPress instance WP Admin and go to
Settings > Google Tag Manager. These are the settings of our plugin and if you click
GTM Presets tab you will see a GTM Presets library available for your plugin version. Select
Google Analytics 4 (Basic for FREE version and Advanced for PRO version) and click
Download. That will download and save
ga4-advanced.json file to your computer.
4. Import GA4 preset
The next step is to import the preset you have just downloaded into your GTM Workspace.
Navigate to GTM Workspace and go to
Admin > Import container. In the new screen select the JSON file and your Workspace (usually the default one). Next select
Merge as the import option and
Overwrite conflicting tags, triggers and variables
. as the sub-option. It's very important to make sure those two options are selected.
Import screen gives you a quick way to preview all the changes import will make to your workspace. Now you can click
Confirm. This will create the changes as draft so you will have an opportunity to review and adjust everything before going live.
5. Update GTM container and publish it!
The last step is to find the
GA4 Measurement ID variable. It can be found on the overview screen that shows all the changes you have just imported, or on the Variables list.
Open this variable and edit its value pasting the Measurement ID for your GA4 property.
Save the change and publish everything to your end users!
You can confirm data is tracked in GA4 realtime screen.