Skip to content
Facebook Twitter Github RSS
Google Tag Manager for WordPress
  • Home
  • FeaturesExpand
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • SetupExpand
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Other setup articles

      Exclude WordPress admins

      Embedded media players

  • DevelopersExpand
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Download
Google Tag Manager for WordPress
Home / Google Tag Manager for WooCommerce / Google Analytics 4 / GA4 – Enhanced Ecommerce tracking – How to setup?

Google Analytics 4 / GA4 – Enhanced Ecommerce tracking – How to setup?

WARNING!

Although the steps bellow will give you proper ecommerce data collection in Google Analytics, there is an easier way now. The article will be updated soon.

This article will show you how to setup ecommerce tracking for your Google Analytics 4 property with Google Tag Manager, WooCommerce and GTM4WP. Google Analytics 4 or GA4 is the next generation of the popular free tool Google Analytics. It uses a completely different data model as well as new reports and user interface. GTM4WP uses the recommended event names of Google to send ecommerce actions like add to cart, product click or purchase.

This article is for users of Google Tag Manager for WordPress plugin v1.12 or newer. If you are using an older version of my plugin, please consider to upgrade.

If you are looking for setup instructions to your Universal Analytics or GA3 tags, please visit the GA3 version of this article.

  • Step 0: pre-setup checks – Google Analyitcs 4 configuration variable
  • Step 1: import GTM4WP Google Analytics 4 container template
    • This import process will create the following new trigger in the workspace
  • Step 2: complete the newly created ecommerce event tag

Step 0: pre-setup checks – Google Analyitcs 4 configuration variable

You do not need to setup anything in your Google Analytics 4 properties. It will automatically pick up ecommerce events and data and show you the results in monetization reports.

In your Google Tag Manager container, you will first need to add a Google Analytics 4 configuration tag if you haven’t added it yet. This will store your Google Analytics 4 web stream ID (G-XXXXXXXXX) and every global attribute you set in it. It will also send a page_view event if you do not change the default behavior of the tag.

Google Tag Manager for WordPress: add Google Analytics 4 configoration tag
  • Start adding a new tag
  • Select Google Analytics: GA4 Configuration
  • Enter your Google Analytics 4 measurement ID (also known as web stream ID)
  • If you are unsure what other options need to be set in this tag, leave everything else in its default state
  • Enter a name at the top of the panel (in the example below you see: GA4 – Pageview – All pages
  • Save the new tag
Google Tag Manager for WordPress: add Google Analytics 4 configoration tag settings

Step 1: import GTM4WP Google Analytics 4 container template

  • Download the following Google Tag Manager GA4 container template
  • On the Google Tag Manager UI, open Admin / Container / Import Container:
Import Container element in Google Tag Manager admin
  • Select the previously downloaded file
  • We highly recommend to create a new workspace during the import process (enter a workspace name you wish)
  • Select the Merge import option
  • To stay on the safe side, select Rename conflicting tags, triggers, and variables
  • You should see only “New” items in the summary table. If you see modified or deleted items as well, check the details in consult with a Google Tag Manager expert if needed
  • Click the Confirm button to proceed

This import process will create the following new trigger in the workspace

  • Event – Ecommerce Events GA4: it will fire on all ecommerce events in your WooCommerce shop

The following variables will be created:

  • Ecommerce: helper variable to pull the most recent ecommerce data from the data layer
  • Ecommerce Items: returns the most recent product data in the data layer. You can use this variable in a Google Ads Remarketing tag to populate dynamic remarketing data
  • Ecommerce Transaction ID: the order ID on the order received page. You can use this variable in other tags where you need to transmit the ID of the order just placed on your site
  • Ecommerce Value: the total value of the order on the order received page. You can use this variable in other tags where you need to transmit the value of the order just placed on your site
  • Ecommerce Tax: the total tax value of the order on the order received page
  • Ecommerce Affiliation: usually empty, could include any affiliate partner name in the future
  • Ecommerce Shipping: the total shipping cost of the order on the order received page
  • Ecommerce Coupon: it includes all coupon codes in a comma separated list that has been redeemed during checkout (variable populated only on the order received page)
  • Ecommerce Currency: the currency used in the last ecommerce action. You can use this variable in other tags where you need to transmit the currency of the order just placed on your site

The following tag will be created:

  • GA4 – Event – Ecommerce events: fires using the trigger described above, uses the event name of the last ecommerce action using the recommended retail event names of Google. Includes all the required ecommerce parameters using the variables listed above

Step 2: complete the newly created ecommerce event tag

Google Analyitcs 4 tag - finish tag setup
  • In Step 0, you either already had a “Google Analyitcs 4: GA4 configuration tag” or you created it while going through the steps
  • Open the “GA4 – Event – Ecommerce events” tag that has been just created in Step 1
  • Open the list in the Configuration Tag drop down
  • Select your GA4 configuration tag (the name might be different than on the screenshot above)
  • Save the changes

Publish everything.

All done!

At this point you setup everything to track ecommerce for Google Analytics 4 in your WooCommerce store. Enjoy! 🙂

© 2023 Google Tag Manager for WordPress - Privacy policy

  • WordPress.org plugin page
  • Plugin support
  • Plugin reviews
Cookies are not evil
This website may use cookies to remember your log-in details, to optimize site functionality for your use, and deliver marketing based on your interests.

This does not include collecting any personal data of you. In any case we need to process any of your personal data, we will ask for your specific consent later for sure.

Accepting this message only means that we will be able to analyze site content performance using larger buckets of users and to deliver tailored messages to those user buckets. We will be not able to analyze your activity alone especially not in a way where your name or any personal data of you is attached to this analysis.

Accept Settings
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-*1 yearUsed by the cookie consent manager of this website to remember your choice of cookie usage.
gtm4wp_last_weatherstatusend of user sessionUsed by a plugin of this WordPress website to dump debug related non-personal data about the weather data identified during your site visit.
Advertising
Tracking codes that could be used to tailor our messages based on your interests. This does not mean that we will be able to track your activities alone especially not in a way that would allow us to connect your name or other personal data to your website activities.
Statistical
Tracking of website usage without using any feature that would involve personal data processing either by us or by our tracking vendor. This includes IP address anonymization and disabling features related to interest based advertising.
Save & Accept
  • Home
  • Features
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • Setup
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Other setup articles

      Exclude WordPress admins

      Embedded media players

  • Developers
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Search