How to integrate Google Analytics UA with WooCommerce?
End-to-end guide on enabling Universal Analytics tracking in WooCommerce shop.
Universal Analytics is no longer available, please use Google Analytics 4 and follow this guide:
How to integrate Google Analytics GA4 with WooCommerce?
Overview
Google Analytics Universal Analytics is a legacy type of GA property that allows gaining insights into users’ behaviors and acquisition patterns.
Although, the best practise is to use the latest GA4 properties (you can see the guide here) there is a number of reasons why you may want or need to use legacy Universal Analytics properties for the time being. You can safely and easily deploy both integrations in your GTM workspace at the same time.
Guide
1. Install and configure Google Tag Manager for WooCommerce
First, make sure that Google Tag Manager for WooCommerce PRO or FREE plugin is up and live in your WooCommerce shop.
You can follow this guide in case of doubts.
2. Prepare Google Analytics UA property
Next prepare a new Google Analytics Universal Analytics property and obtain its tracking ID.
Once it is ready, go to your UA property, click the gear icon in the bottom left, and select Tracking Code
. On the new screen you will see Tracking ID
that you need to copy.
3. Download Google Analytics UA preset
After that navigate back to your WordPress instance and go to Settings > Google Tag Manager
. These are the settings of our plugin and if you click GTM Presets
tab you will see presets available for your version of the plugin. Select Google Analytics UA
(Basic or Advanced depending on the version of your GTM plugin) and click Download
That will download and save ua-basic.json
or ua-advanced.json
file to your computer.
4. Import Google Analytics UA 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 ua-basic.json
or ua-advanced.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 bring the changes as draft so you will have opportunity to review and adjust everything before going live.
5. Configure the preset and publish it!
The last step is to find the UA Settings
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 Tracking ID
copied in step 2 above into the Tracking ID
field.
Save the change and publish everything to your end users!