Google Analytics 4 ecommerce tracking for Easy Digital Downloads – How to setup?
WARNING!
This guide doesn’t consider whether you’re utilizing a Consent Management Platform (CMP) or your preferred method for incorporating Google Consent Mode into your Google Tag Manager container. The steps to ensure the privacy of your measurement setup often rely on your chosen CMP. Reach out to your CMP’s support team for assistance.
What is this article about?
This article shows you how to set up ecommerce tracking for your Google Analytics 4 property with Google Tag Manager, Easy Digital Downloads and GTM4WP. GTM4WP uses the recommended event names of Google to send ecommerce actions like add to cart, product click or purchase.
This page describes GTM4WP 2.1.0 and newer, the first version with Easy Digital Downloads support. Running WooCommerce instead? Follow the WooCommerce version of this guide.
You do not need to set up anything in your Google Analytics 4 property to be able to analyze ecommerce data. It automatically picks up ecommerce events and data and shows the results in the Ecommerce purchases report.
Step 0: pre-setup checks
Two things need to be in place before you import anything into your container.
Turn on ecommerce tracking in the plugin
- Open the GTM4WP plugin settings page and go to the Easy Digital Downloads section
- In the General group, turn on Track e-commerce
- Save the plugin settings
This option is off by default. While it is off, GTM4WP does not register any of its Easy Digital Downloads hooks, so no ecommerce data reaches the data layer and the tags described below have nothing to fire on. The section shows its options only while Easy Digital Downloads 3.0 or newer is active.
Add the Google tag
In your Google Tag Manager container, you will first need to add a generic Google 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 the page_view event if you do not change the default options in the tag.

- Start adding a new tag
- Select Google tag
- Enter your Google Analytics 4 measurement ID (also known as web stream ID)
- It is recommended to store this ID in a variable of the type constant, as it will be needed in your event tracking tags as well. The container template imported in Step 1 already contains such a constant
- Depending on your setup in GA4 admin, you might want to enter the more generic Google Tag ID (GT-XXXX) which will also work, but in GA4 event tags, you will always need to enter the GA4 measurement 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: Google Tag – Pageview – All pages)
- Attach a trigger to the tag: you may choose the generic All pages trigger automatically created in every GTM container, but you can also select the Initialization – All pages trigger to make sure the page view event is sent before all other events. Note: this does not guarantee that the page view event is always the first during a page load, but it gives it a higher chance.
- Save the new tag
Step 1: import GTM4WP Google Analytics 4 container template
The template is the same one the WooCommerce guide uses. The data layer of both integrations uses the same event and variable names, so one container serves both.
- Download the following Google Tag Manager GA4 container template (last updated: 2026. 08. 10)
- On the Google Tag Manager UI, open Admin / Container / Import Container:

- Select the previously downloaded file
- We highly recommend that you 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, and consult a Google Tag Manager expert if needed
- Click the Confirm button to proceed
The triggers created by the import
- Event – Ecommerce Events: it fires on all ecommerce events in your Easy Digital Downloads store
- Event – Purchase: it fires on the purchase event only. The two Google Ads tags use this trigger
The tags created by the import
- GA4 – Event – Ecommerce events: fires on the ecommerce events trigger and sends the name of the last ecommerce action using the recommended retail event names of Google. This is the tag this article sets up
- Google Ads – Conversion – Purchase and Google Ads – User-provided Data – Purchase: covered by the Google Ads guide for Easy Digital Downloads
The two Google Ads tags ship with placeholder IDs. If you are not setting up Google Ads now, pause them until you do, so they do not fire with placeholder values.
The variables created by the import
The template contains 68 variables. Only the ecommerce group and the GA4 ID constant are needed for the setup described here. The rest are there so that other tags can be fed with the same data without building anything by hand.
- 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 number on the purchase confirmation 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 purchase confirmation 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 purchase confirmation page
- Ecommerce Affiliation: usually empty, could include any affiliate partner name in the future
- Ecommerce Shipping: always empty with Easy Digital Downloads, which has no shipping
- Ecommerce Coupon: all discount codes redeemed during checkout, in a comma separated list (populated only on the purchase confirmation 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 remaining variables fall into these groups:
- 25 variables prefixed with Order Data –, which read the order on the purchase confirmation page. They stay empty unless the Order data in data layer option is on in the Data layer content group of the plugin’s Easy Digital Downloads section. The 7 shipping variables always stay empty, because Easy Digital Downloads has no shipping
- 25 variables prefixed with Customer –, which read the account details of a logged-in customer on every page. They need the Customer data in data layer option in the same group. Only 4 of them work with Easy Digital Downloads: Customer – First Name, Customer – Last Name, Customer – Total Orders and Customer – Total Order Value. The others read billing and shipping details that Easy Digital Downloads does not keep for a customer account
- User Data (Enhanced Conversions) and User-Provided Data, which carry the identifiers used by Enhanced Conversions. These also need the Customer data in data layer option
- Customer Type and New Customer, which tell new and returning buyers apart on the purchase event
- 5 constants: GA4 ID, Google Ads Conversion ID, Google Merchant Center ID, Google Merchant Center Feed Country and Google Merchant Center Feed Language. Only the first one matters for this guide
The import also activates the built-in Event variable.
Step 2: enter your GA4 measurement ID
The ecommerce tag does not hold your measurement ID directly. It reads the GA4 ID constant, which the template ships with the placeholder G-XXXXXXXXXX.

- Open the Variables section and edit the GA4 ID constant
- Replace the placeholder with your own GA4 measurement ID
- Do NOT enter your Google Tag ID here even if you did this in your Google Tag
- Save the variable
- Open the “GA4 – Event – Ecommerce events” tag and make sure the message next to the measurement ID says Google tag found in this container!
Publish everything.
Check your work
Open Google Tag Manager preview mode and walk through your store: a page that lists downloads (view_item_list), a download page (view_item), a buy button (add_to_cart), the checkout (begin_checkout) and a test purchase (purchase). Each event should fire the “GA4 – Event – Ecommerce events” tag. There is no add_shipping_info event, because Easy Digital Downloads has no shipping step.
If the purchase event is missing, check the order status and age first. By default the purchase counts while the order is Pending, Processing or Complete and no older than 30 minutes. The settings reference explains both options.
All done!
At this point you have set up everything to track ecommerce for Google Analytics 4 in your Easy Digital Downloads store. Enjoy! 🙂

