[UPDATE 30th April 2021 – bonus video at the end of this article]
As you probably know, the new version of Google Analytics has now the final name of Google Analytics 4 (previously it was called App + Web).
In this guide I will explain to you how to configure an E-commerce for tracking with Google Analytics 4, and – specifically – I will focus on how to move from the traditional Enhanced E-Commerce tracking to the new e-commerce tracking provided by Google Analytics 4 (it is no longer called “Enhanced E-commerce”, just simply “E-commerce”).
Why should I switch to Google Analytics 4?
There are – at least – three good reasons to perform the switch:
- the “traditional” e-commerce tracking, which involves setting Enhanced E-commerce on Universal Analytics (the version of Google Analytics prior to GA4), is going to be progressively replaced by the new tracking based on Google Analytics 4. In other words, sooner or later, the “traditional” e-commerce tracking will probably be discontinued.
- the GA4-based e-commerce tracking, which unlike the previous one can be set with a Template that allows you to move from the traditional session-based tracking model to the new event-based model. This means your tracking can be much more accurate than before, because in the new GA4 there are many more events than in the “traditional” Google Analytics (Universal Analytics).
- the use of GA4 allows you to start using Google’s machine learning models, which are able to predict the future actions of our users (eg. the purchases they will make through a Predictive Custom Audience), analyzing the data related to their behavior. The technology is still in beta but already usable, and I definitely recommend you try it.
Introduction
In order to track E-commerce in GA4, we will use the Template I made for this purpose.
You can find it in the official Google Tag Manager Gallery at this link:
As I mentioned, GA4 is based on events. You can find the list of events managed by GA4 in the official guide:
The good news is that it is possible to reuse some of the actions present in the “traditional” Enhanced E-commerce settings (based on Google Universal Analytics) and to transform them into GA4 actions.
Let’s clarify this point. In this table you can find the GA Universal Analytics event list in Enhanced E-Commerce (EEC for friends) in the first column and the Google Analytics 4 event list in the second column:
“Ok, but what are all those colors about?”
Here we go 🙂
- The green events are handled automatically by my Template, so no further configuration is needed
- The yellow events will need a specific configuration of the variable. In detail, the step number of the Google Universal Analytics checkout event must be configured. The number indicated in brackets in the image above is the default number that the Template attributes (of course you can change it if the action of GA4 corresponds to a different step number)
- The red event is not currently managed by my Template. This is because wishlist action management is not present in the “traditional” Google Universal Analytics.
Now let’s go and configure everything 🙂
Step 1 – Import the “EEC dataLayer Builder for GA4 variable” Template
Import the Variable Template “EEC dataLayer Builder for GA4” You can find it in Google’s Community Template Gallery. It is easier done than said 😀
Just follow these steps:
- Templates > Variable Templates > Search Gallery
Search for EEC dataLayer Builder for GA4 and click on “Add to Workspace“
The EEC dataLayer Builder for GA4 Template that you just imported will look like this:
Great, now we just have to use this Template to create two custom variables.
Step 2 – Create the two custom variables for GA4
Now you will need to create two custom variables:
- the GA4 – Event Name variable, which will manage the name of the e-commerce event
- the GA4 – Items variable, which will manage an object that contains all the parameters
Configure the variable GA4 – Event Name
GA4 – Event Name has the purpose of uniquely identifying the name of the standard event to be passed to GA4 for e-commerce tracking purposes.
Here is how to do it:
- Go to Variables > User-Defined Variables
- Click on New and choose EEC dataLayer Builder for GA4
- On the Mode listbox select Event Name
- Checkout Events > enter the numbers of the checkout steps that will correspond to begin_checkout, add_shipping_info and add_payment_info
- View Cart Event: if you want to track it, select it and enter the step number
- Variable name: GA4 – Event Name
- Save
Here are the step values that you will find in the image below:
- 1 = view_cart (this is not enabled by default)
- 2 = begin_checkout (the default step is 1)
- 3 = add_shipping_info (the default step is 2)
- 4 = add_payment_info (the default step is 3)
Configure the variable GA4 – Items
GA4 – Items has the purpose of managing the object items which will contain all the information needed for GA4.
In detail, the object will manage two possible scenarios:
- first scenario: the dataLayer push for the “traditional” Enhanced Ecommerce di Google Universal Analytics
- second scenario: the dataLayer push for the new Ecommerce di Google Analytics 4
Thanks to the management of both these scenarios, with this variable you will always have the correct structure for Google Analytics 4 🙂
Here are the steps to follow for this configuration:
- Go to Variables > User-Defined Variables
- Click on New and choose> EEC dataLayer Builder for GA4
- On the Mode listbox select Items
- Default Currency value: EUR (you can insert a different default value currency)
- Variable name: GA4 – Items
- Save
Step 3 – Create the dataLayer variables for purchase and refund
Unfortunately, the purchase and refund event must handle some parameters – seven to be precise – that are outside the object items.
In detail, the seven parameters to be handled are:
- transaction_id
- affiliation
- value
- tax
- shipping
- currency
- coupon
These parameters are all contained in different positions inside the GTM dataLayer, depending on whether the dataLayer push was done for Google Universal Analytics or Google Analytics 4.
If you want to handle both the configurations (but this is a very unlikely case) then you would have to create 14 dataLayer variables in GTM.
The first scenario (Google Universal Analytics)
Let’s assume that you only have to manage the dataLayer of the Enhanced Ecommerce of Google Universal Analytics (this is the first of the two scenarios that I mentioned earlier).
Let’s start by creating one Variable for each of the seven parameters.
Here’s how to do it:
- Go to Google Tag Manager > Variables > User Defined Variables > New > Variable Configuration
- Variable type: Data Layer Variable.
- Data Layer Variable Name: ecommerce.purchase.actionField.revenue
- Data Layer version: Version 2.
- Rename the Variable “dlv – ecommerce.purchase.actionField.revenue” and save it.
The configuration should look like this:
Now you just have to repeat this operation 6 times, changing the value to red for the other variables with:
- ecommerce.purchase.actionField.affiliation
- ecommerce.purchase.actionField.coupon
- ecommerce.purchase.actionField.id
- ecommerce.purchase.actionField.shipping
- ecommerce.purchase.actionField.tax
- ecommerce.currencyCode
Rename all variables by adding a simple prefix: “dlv –”
Please be careful about ecommerce.currencyCode
This parameter is optional in Google Universal Analytics, but it is required in Google Analytics 4. If you don’t pass the currency parameter in GA4, the transaction event has some problems.
My suggestion is to check “Set Default Value” and insert “EUR” (if your e-commerce has Euro currency by default).
If your e-commerce also handles refunds, then you’d need to add an eighth variable, named
- ecommerce.refund.actionField.id
Once this is done, you should have a list like this:
The second scenario (Google Analytics 4)
In the second scenario relating to the management of GA4 events that I described above, you need to create only the variables relating to the management of GA4.
(In this case, the dataLayer push is already passing the object items.)
Consequently, the seven dataLayer variables to create are:
- ecommerce.affiliation
- ecommerce.coupon
- ecommerce.currency
- ecommerce.shipping
- ecommerce.tax
- ecommerce.transaction_id
- ecommerce.value
(In the following steps I will not consider this second scenario, and I will refer exclusively to the first scenario).
Step 4 – Create GA4 Tag Triggers
Now you just have to identify the name of the events in Google Universal Analytics (you should already have the event list if you have already implemented the Google Analytics Enhanced E-Commerce).
It all depends on how Enhanced E-commerce has been implemented, for example through modules / plugins in your CMS (WooCommerce, Prestashop, Magento, Shopify, etc), or through a custom software solution crafted by a software engineer.
[NOTE] It is possible that some pushes in the dataLayer to manage actions such as: promo impression, detail, checkout or purchase, were performed before the GTM event Container Loaded (ex Page View) and were performed without having declared the name of the event.
(By the way, if you do not declare the name of the event, you should get a slap on the wrist!)
The trick – or #barbatrucco, in Italian slang – to manage this situation (handling Message events in GTM debug) is to use GTM’s “All Pages” native trigger.
Also, if the transaction event (purchase) is done BEFORE the Container Loaded native event, then you will need to create a negative trigger and put it as exception to the Google Analytics 4 Tag which does not handle the transaction (purchase). This is because you would trigger the transaction (purchase) events two times. Don’t worry, you will see it well in step 5.
For the sake of simplicity, I will separate the actions purchase and refund from the other actions.
(I don’t think I have ever seen the action refund configured in Google Analytics).
In this example, I will use the WooCommerce implementation with the Duracell Tomi plugin.
Please note that in this example there are two actions that are not handled with a specific event:
- detail (product detail)
- checkout (step 1 of the checkout)
(Duracell Tomi, you should definitely get a slap on the wrist for this!)
Create the trigger GA – EEC Events
My intent here is to track all GA’s Enhanced E-Commerce actions excluding purchase and refund.
- Click on Trigger > New > Trigger configuration
- Trigger type: Custom event
- Event Name: gtm4wp.addProductToCartEEC|gtm4wp.checkoutStepEEC|gtm4wp.productClickEEC|gtm4wp.productImpressionEEC|gtm4wp.promoClickEEC|gtm4wp.promoImpressionEEC|gtm4wp.removeFromCartEEC
- Flag: Use regex matching
- Fire this trigger fires on: All custom events
- Trigger name: “GA – EEC Events”
- Save
Create the Trigger GA – EEC Purchase
Here the intent is to track the purchase:
- Click on Trigger > New > Trigger configuration
- Trigger type: Custom event
- Event Name: gtm4wp.orderCompletedEEC
- Fire this trigger fires on: All custom events
- Trigger name: “GA – EEC Purchase”
- Save
Well, it was easier than expected, wasn’t it?
Let’s move on to the Tags and we’re done 🙂
Step 5 – Create the Google Analytics 4 Tags
Create the Google Analytics 4 property and the data stream
You’ve probably already created your property in Google Analytics 4 and the Data Stream of your site.
In case you have any doubts here is a small intro by Krista Seiden, who explains how to do it:
Retrieve your Google Analytics 4 code G-XXXXXXXX from your data stream.
In my case the value is: G-7CSDVRME94
Well, now let’s move on to the creation of the Tags:
Create the GA4 Configuration Tag
The Google Analytics 4 Configuration Tag will allow us to more easily manage GA4 events in the Event Tags.
- Tag type: Google Analytics: GA4 Configuration
- Measurement ID: G-XXXXXXXXX
- Trigger: All Pages
- Tag Name: GA4 – Configuration
Create the two GA4 Event Tags to manage E-commerce tracking
This is the last step before the final verification with debugging.
Beware of triggers. As explained before in red if not all e-commerce actions are handled by a specific event and are pushed before Container Loaded we will need to use the “All Pages” activator as well.
Also if the specific event of the transaction (in our case it will be gtm4wp.orderCompletedEEC) is pushed before the Container Loaded as in the image below:
then a universal negative trigger must be set up for the GA4 – EEC Tag.
This is the universal negative trigger for the purchase.
- Click on Trigger > New > Trigger configuration
- Trigger type: Custom event
- Event Name: .*
- Flag: Use regex matching
- Fire this trigger: GA4 – Event Name then choose equals and purchase
- Name: “GA4 Event Name – Purchase”
- Save.
So you have three possible cases, obviously, you will have to choose the one that best suits your situation:
- case A
Select as trigger ► GA – EEC – Events
If there are pushes before Container Loaded that are not handled by a specific event ► also choose All Pages trigger
If your purchase event is pushed before Container Loaded ► create the negative trigger “GA4 Event Name – Purchase” and put it as an exception - case B
Select as trigger ► GA – EEC – Events
If there are pushes before Container Loaded that are not handled by a specific event ► also choose All Pages trigger - case C
If all events are declared then just choose ► GA – EEC – Events as trigger
Case A
- Tag type: Google Analytics: GA4 Event
- Configuration Tag: choose from the list > GA4 – Configuration
- Event Name: choose the variable {{GA4 – Event Name}}
- Event Parameters: click on Add Row
- Parameter Name: items
- Value: choose the variable {{GA – Items}}
- Trigger: All Pages , then choose the Trigger GA – EEC – Events
- Exeptions: GA4 Event Name – Purchase
- Name: GA4 – EEC
- Save
Case B
- Tag type: Google Analytics: GA4 Event
- Configuration Tag: choose from the list > GA4 – Configuration
- Event Name: choose the variable {{GA4 – Event Name}}
- Event Parameters: click on Add Row
- Parameter Name: items
- Value: choose the variable {{GA – Items}}
- Trigger: All Pages , then choose the Trigger GA – EEC – Events
- Name: GA4 – EEC
- Save
Case C
- Tag type: Google Analytics: GA4 Event
- Configuration Tag: choose from the list > GA4 – Configuration
- Event Name: choose the variable {{GA4 – Event Name}}
- Event Parameters: click on Add Row
- Parameter Name: items
- Value: choose the variable {{GA – Items}}
- Trigger: choose GA – EEC – Events
- Name: GA4 – EEC
- Save
My case (that of Woocommerce) is case A
Now I am going to create the Tag for the action purchase because, as I mentioned before, I need to pass the seven additional parameters.
- Tag type: Google Analytics: GA4 Event
- Configuration Tag: choose from the list > GA4 – Configuration
- Event Name: choose the variable {{GA4 – Event Name}}
- Event Parameters: click on Add Row
- Parameter Name: items
- Value: choose the variable {{GA – Items}}
- Event Parameters: click on Add Row
- Parameter Name: transaction_id
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.id}}
- Event Parameters: click on Add Row
- Parameter Name: affiliation
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.affiliation}}
- Event Parameters: click on Add Row
- Parameter Name: tax
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.tax}}
- Event Parameters: click on Add Row
- Parameter Name: shipping
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.shipping}}
- Event Parameters: click on Add Row
- Parameter Name: coupon
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.coupon}}
- Event Parameters: click on Add Row
-
- Parameter Name: value
- Value: choose the variable {{dlv – ecommerce.purchase.actionField.revenue}}
-
- Event Parameters: click on Add Row
- Parameter Name: currency
- Value: choose the variable {{dlv – ecommerce.currencyCode}}
- Trigger: GA – EEC – Purchase
- Name: GA4 – EEC – Purchase
- Save
Step 6 – Debug and verify operation
Activate the Google Tag Manager Debug Preview and check if the Tags are activated and if they actually manage the parameters in GA4 🙂
As you can see, product impressions are handled. Events number 3 and 4 have the tag GA4 – EEC fired:
If you click the Tag and check the Values, you can notice that both the name of the event view_item_list and the values of the items are handled correctly:
Now it’s time for the final test: let’s check if Google Analytics 4 actually receives the values.
To do this, just change the GTM code to the GA4 code on the Tag Assistant.
Now you will see all the Hit Sent in Google Analytics 4.
In detail, I have the values 3, 4, and 5 which correspond to the GA4 event:
- Page View
- View Item List
What about the purchase? That works too 🙂
Check GA4 transaction on GTM Debug
Go to debug of GTM and click the G-XXXXXX icon on the left-top menù. Search your purchase transaction and check if there are all transaction parameters:
Conclusion
Well, now you have no more excuses! You can track your e-commerce with Google Analytics 4 and start exploring all the new features of the new version of Google Analytics.
If you have any doubts or questions, please leave me a comment 😉
BonusVideo
MeasureCamp UK Virtual 2021 – The next Level of e-commerce tracking GA4 with GTM
The GA4 Spaghetti Carbonara at SuperWeek 2021
With my business Partner Roberto, we talked about “The GA4 Spaghetti Carbonara”. Enjoy 🙂
Chiedi pure qui sotto, sarò pronto a risponderti!
IK
21 03 2023
Hello!
I have used your template and this guide to install GA4 ecommerce.
I noticed today that Google Tag Manager for WordPress has a guide for GA4 where they offer their own GA4 container template:
https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking-google-analytics-4-ga4-version
Do you recommend that I switch out my template from yours to this one? What is the difference?
Thanks so much!
Matteo Zambon
29 03 2023
Hi Isabella, I recommend to use the GA4 dataLayer 🙂 So the best way is use the native GA4 configuration without custom template 🙂
Let me know if it works for you.
Matteo
Antonio
02 12 2022
Buongiorno Matteo,
ho seguito passo passo la guida, ma credo ci sia qualche problema perchè non vedo nessun dato in modalità debug.
Non capisco se il data layer viene creato correttamente.
Il sito è realizzato con woocommerce, come potrei verificare dove sta il problema?
Grazie
Matteo Zambon
23 10 2023
Ciao Antonio, difficile aiutarti così. Riesci a darmi maggiori info sul gruppo di Facebook GA4 Italia: https://www.facebook.com/groups/337447218293900
Buon GA4!
Rory
15 04 2022
Thanks so much for doing this guide, Matteo. It’s been a huge help to me. I have it mostly working, I see the purchase events, and the items on the order….but in “Monetization” the “Total Revenue”, “E-Commerce Revenue” and “Item Revenue” is always 0.00
In “realtime” I can see the purchase event has a value. I’m not sure how to debug the 0.00 values. Do you happen to have any ideas?
Thanks again!
Matteo Zambon
17 05 2022
Hey Rory, did you check the currency parameters? It’s a mandatory if you want to see the revenue on GA4.
Let me know.
Peter Starzynski
07 02 2022
Hi Matteo,
Do you know why events like view_item and add_to_cart are doubled inside GTM Server Side? I am using this tag to send events further to GTM Server Side.
All config inside standard GTM looks fine. Just one event like add_to_card is being fired, but two are visible inside GTM Server Side. All other tested activity like page_view, select_item, select_item_lists works like a charm.
Any clue?
Matteo Zambon
08 02 2022
Hi Peter, I will check it and I will send an email 🙂
Thank you!
John Langlois
09 06 2021
Thank you for the detailed and comprehensive nature of this material. I would have lost the train of thought without your specificity on each step. Google should pay you to develop “how to” resources for them.
Matteo Zambon
16 06 2021
Hi John! Thank you very much for this feedback.
Actually, I’m an official beta tester of GTM 😉
Cesar Augusto
07 04 2021
Hello Matteo,
Thanks for this tutorial. It’s amazing. I have an issue.
The event parameter “Items” not work on GA4 configuration purchase Tag. It shows a value {{Objetct}} and not the name of product.
Take a look on images.
https://imgur.com/RkdLKMY
https://imgur.com/euxqL3M
https://imgur.com/W0tJ5X5
https://imgur.com/kd9RFFp
Matteo Zambon
18 04 2021
Hi Cesar, could you share the configuration of the purchase tag?
This is the configuration:
Let me know 🙂
Niels uit het Broek
07 04 2021
Hi Matteo,
Thank you so much for the clear explanation. I have one problem. When I test Case A, there are no tracked conversions. When I use Case B or C, the conversions are tracked double.
Some screens: https://1drv.ms/u/s!AieHhpISGzhzhG01BEY0QxDMpxEY?e=kEsdm9
Shop: https://sioux.shopping.nl/
Matteo Zambon
18 04 2021
Hi Niels, you need to set up the exception trigger purchase in the GA EEC tag. Make sure the purchase event still exists.
Let me know if it works
Nick
10 03 2021
Hi Matteo, first of all thanks from The Netherlands for the awesome tutorial and template. I can’t imagine how much work this have costs you, so I’m very glad you helped us all with this!
I’ve walked trough all steps and everythings seems to work perfectly. I only don’t see any ecommerce value on the overview page: https://dsc.cloud/4f0660/Screen-Shot-2021-03-10-10-07-19.06.png. But when I look under ecommerce purchases I do see the value and the products which are bought: https://dsc.cloud/4f0660/Screen-Shot-2021-03-10-10-08-36.30.png.
Is this a setting in Google Analytics or am I missing something? 🙂
Thanks already for your reply mate!
Ciao Ciao,
Nick
Matteo Zambon
16 03 2021
Hi Nick and thank you for your feedback. Did you check the GA4 parameters in the GTM debug mode?
Did you see these parameters?
Please, be careful about ecommerce.currencyCode.
Let me know.
Timothe
06 03 2021
Hello Matteo,
Thanks for this fantastic guide! I was used to Universal analytics and I must admit that the switch to GA4 is tough … Thanks to your guide everything is working perfectly!
I just have a small problem, I’m trying to bring up the add to cart event in analytics. Does your variable do this automatically or do I need to create a new one?
Basically, I only view items and purchase on alytics right now. I tried by following other guides to create a new add to cart variable in addition: https://prnt.sc/10ed7uw
Also, it seems that I should add an event on GA4 to display it, it is not included in the base? I did not find anything on the subject here is what I added:
https://prnt.sc/10ed8zb
Thank you very much !
Matteo Zambon
09 03 2021
Hi Timothe, you don’t implement a specific Tag for add_to_cart, because all parameters are in the object “items” and it’s ok with my template variable (step 5).
Could you share URL of your ecommerce?
Thank you!
Hugh
02 03 2021
Hi Matteo,
Great article, thanks. I have implemnted all the steps, but in preview I am not seeing any of the Custom Events. I can see that tags are firing as they should, but not custom events. No errors showing though, which is good. I am using WooCommerce and so wnet with case 3 with the negative tag. Thanks.
Matteo Zambon
02 03 2021
Hi Hugh and thanks.
Ok, are you sure the Universal Analytics Enhanced E-Commerce is set up? Could you share the URL or some screenshots?
Thanks
Vladislav
27 02 2021
Hi MATTEO ZAMBON! Thank you very much for the detailed guide – this is really valuable and high-quality information.
Can I ask a question:
I am migrating from old DataLayer format
Configured everything as it should be using converter (template) for Items
But in Google Analytics, monetization turns out to be a complete mess http://prntscr.com/108d7t6
Doesn’t count adding to cart, revenue, quantity of items, adding to cart
In this case, the total income is calculated http://prntscr.com/108d8um
Here are the main events
Add2cart http://prntscr.com/108db0b
(tag http://prntscr.com/108df8h)
Purchase http://prntscr.com/108d3mu
(tag http://prntscr.com/108dgna)
I look and understand – everything is configured correctly
But in the end, the data in Google Analytics is not correct !!!
All data that goes into the e-commerce of the classic Google Universe Analytics is correct
What could be the problem? I need GA4 and GUA to work together
Understand why data is not being received correctly in GA4 e-commerce
Matteo Zambon
02 03 2021
Hi Vladislav, I fixed the category items some days ago and the quantity items parameters”. Did you see the same problems on the Demo Account – GA4 -Gooogle Merchandise Store?
In the API Call could you show me if the parameters are in the hit (add_to_cart)?
Thank you!
Vladislav
05 03 2021
Update? Perfectly. I renewed! I’ll try all the tags again today
I have not used the demo version of GA4, I am working on a test copy of my site
Did I understand correctly what you are asking about? Here is a screenshot from DataLayer while adding item to cart http://prntscr.com/10cz199
And this is http://prntscr.com/10cz5p7 that falls into the add_to_card tag from DataLaer
Thanks for the answer!
upd.
Yesterday I updated your template, made orders – today I checked it, it did not give any result. I don’t understand what’s going on
Matteo Zambon
09 03 2021
Hi Vladislav, I mean: ho to debug of GTM and click the G-XXXXXX icon on the left-top menù. Search your add_to_cart event and check if there are all event parameters. Seems like this:
Let me know
Waleed
24 02 2021
Hi,
Thank your for writing such comprehensive guide.
Just a quick question, why are there two productImpressionEEC tags fired on home page? While on all other pages it is fires once? Won’t it cause duplication? Is it a bug or is it fine?
I have looking into it and haven’t got any solutions whether it is fine or not? For universal analytics for product impression i have set the tag to fire once per page as a solution.
Thanks,
Matteo Zambon
02 03 2021
Hi Waleed, and thank you for your feedback. It’s because impression events contain different e-commerce objects. So you have more events with the same category, but the parameters for EEC are different 🙂
Just be careful with the limits of GA (500 hits for the session).
You can increase the number of products for impression in the WP plugin settings.
Let me konw 🙂
Buon Tag!
Fred
09 02 2021
Hello Matteo, thank you so much for your amazing guide, but I don’t know why my tags do not fired and not showing.
I followed all instructions and also verified 3 times where are my mistakes but still cannot find it.
fred
09 02 2021
These are screens https://imgur.com/a/cCD8aoS
Matteo Zambon
12 02 2021
Hi Fred, I see the GA4 – EEC fired, and the GA4 – EEC – Purchase not fired. Where is the problem?
Matteo Zambon
12 02 2021
Hi Fred, could you attach here more information? Some screenshot?
Let me know
HUgh
02 03 2021
Hi,
Great article. I have followed all the seps, but in debug I am not seeing any of the custom events in the Summary when I debug GA4- EEC and GE4 – EEC Purchase. Also not seeing any errors.
Matteo Zambon
02 03 2021
Hi, could you share the URL website or some screenshot?
Thanks!
Rob
06 02 2021
HI,
When I finish the config and choose option A and choose preview I get an error message saying:
Onbekende variabelenaam
GA4 – EEC – Purchase
Er is een onbekende variabele {name} gevonden in een tag. Bewerk de tag en verwijder de verwijzing naar de onbekende variabele.
If I translate this it says unknown variable name. There is an unknown variable found in the tag. Edit the tag and remove the reference to the unknown variable.
I cannot find what I did wrong. Can you help me?
Thanks!
Matteo Zambon
12 02 2021
Hi Rob, probably you don’t use the right variable.
Could you share some screenshots configuration?
Let me know
Frederic Verville
05 02 2021
Hy Matteo
Here is some picture of the double purchase problem :
https://1drv.ms/u/s!AsDfU55Gejq0-jisB5bt63MlEIzG?e=xb4PeZ
Matteo Zambon
09 02 2021
Hi Frederic, please check case A. You have to check if the tag “GA – EEC – Events” is fired. I suggest using case A to exclude the firing of the tag.
Let me know
ghazanfar
04 02 2021
I followed the same method as mentioned above but dual purchase is showing upon single purchase. Rest Everything is fine. I’m using wordpress woocommerce website. So where is the issue and how I can fix that?.
Matteo Zambon
09 02 2021
Hi, you have to check if the tag “GA – EEC – Events” is fired. I suggest using case A to exclude the firing of the tag. Let me know
Frederic
18 01 2021
Very nice guide! I tought it would fix my problem. I have Woo Commerce so I followed option A but I still have duplicate purchase in my GA4.
Thank you for this amazing guide and help.
Matteo Zambon
21 01 2021
Hi Frederic, do you have both GA4 Tags fired in your GTM Debug? Could you share some screenshots of GTM debug in the purchase action of GA4?
Thanks
ghazanfar abbas
08 01 2021
If you have a youtube channel where you explained all this method, please share that with us
Matteo Zambon
14 01 2021
Hi, at the moment I have only Italian video 🙂
I will do it on MeasureCamp London event this Saturday (15th Jan).
chirag
06 01 2021
MATTEO ZAMBON You are like boom buddy… thank you for your step by step detailed explanation.. thanks again for help me to get this done easily.
Matteo Zambon
07 01 2021
Hi Chirag and thank you for this feedback 🙂
IK
21 12 2020
Hello!
Thank you so much for this guide!
Looking at the recommended e-commerce events from google I can see that each event (not just the purchase event) are recommended to have more than one parameter such as currency, value, coupon etc.
I’ve implemented enhanced ecommerce according to your guide but from what I understand, with your implementation I am only passing the “items” parameter for the non-purchase events like add_to_cart, remove_from_cart etc. and no other parameters.
At least I can’t see any other parameters for these events when looking at debug_view or in my reporting.
Am I missing something or have you chosen to NOT include other parameters like value, coupon etc. for non-purchase events for a particular reason? 🙂
Thanks so much!
Matteo Zambon
21 12 2020
Hi, my guide is trying to rebuild from UA’s currently powered ecommerce to GA4 ecommerce.
UA EEC object is different from Ecommerce GA4.
So, in the UA object, the coupon is found only on the transaction event.
Can you share with me what guide you have read? Because there are 3 guides in GA4 and all of these are not the same: D
Of course, you can create a single tag event with a specific custom event and add ALL parameters that you need (for example payment_type in step 3 of your UA EEC with the checkout options parameter).
Let me know 🙂
IK
12 01 2021
Hello again!
So sorry for the late reply. Ah ok I understand what you mean. I followed this guide which I am commenting on, option A.
Nice, I will look into that!
Can I also then add a datalayervariable for currency and connect this to “currency” in the GA4 ecommerce tag for example?
Thank you so much again 🙂
Matteo Zambon
14 01 2021
Hi, you have to add the currency in purchase event 🙂
Let me know 🙂
IK
08 02 2021
Hello again!
I am still a bit confused about the paremeters for the ecommerce events like add_to_cart, remove_from_cart, view_item etc.
In the GTM tag “GA4 – EEC”, is it correct if I add this row:
parameter name: currency AND value: {{DLV – ecommerce.currencyCode}}
As I understand it, all the ecommerce events need the currency parameter, not just the purchase event?
Matteo Zambon
12 02 2021
You are right. I updated my template and now you can associate the default currency in the items object of dataLayer 😀
Thanks
Riccardo
17 12 2020
Ciao Matteo,
prima di tutto complimenti per l’articolo, ti seguo dal corso di studiosamo e mi hai incuriosito con le potenzialità di Google Tag Manager.
Ho provato ad implementarlo sul mio ecommerce (woocommerce). Ho notato però che gli acquisti in real time vengono conteggiati doppi, secondo te dovrei avrei potuto sbagliare?
Grazie.
Riccardo
17 12 2020
Problema risolto, avevo sbagliato io.
Per chi utilizzasse WooCommerce e si trovasse nella mia stessa situazione ho risolto così:
1. Aggiunto l’universal negative trigger (GA4 Event Name – Purchase)
2. Messo nel tag GA4 – EEC l’eccezione del negative trigger cioè il GA4 Event Name – Purchase (precedentemente l’avevo confuso con il trigger GA – ECC Purchase)
Matteo Zambon
18 12 2020
Uh, grazie del feedback Riccardo 🙂
A presto!
Giulia
09 12 2020
Hi Matteo,
could you explain further the Checkout Events numbers part? I don’t get if they mirror the different pages of the checkout process or they define only the logical order in which the steps are presented.
ie, for a single page checkout or a checkout that allow to skip the cart page, how do the numbers change?
Thank you!
Matteo Zambon
15 12 2020
Hi Giulia 🙂
If your one-page checkout is already set up for EEC, then you have already the step numbers of checkout. If you don’t have that, you have to create a specific push in dataLayer when the user fills out the fields in a specific area (for example step 1 = all fields in the registration form).
If you cannot create the push directly on the page with your developer, you can create a “magic” listener javascript (with blur events) and add that with custom HTML.
Let me know if is all ok
Matt
02 12 2020
Hello Matteo,
Thanks for this tutorial!
I have a problem with my purchase event, all my variables are “undefined”.
Look at this screenshot : https://imgur.com/ACBjlym
Do you have any idea how to fix this?
Matteo Zambon
02 12 2020
Hi Matt, could you show me the original dataLayer.push? I suppose the ecommerce items for Universal Analytics is missing.
Let me know 🙂
Matt
02 12 2020
Thank you for your reply!
Here is the part of the dataLayer.push :
https://imgur.com/PxHFDC7
Matteo Zambon
07 12 2020
Hi Matt, I have to check your GTM configuration,. The purchase by gtm4wp.orderCompletedEEC event seems ok. So, I think there is a mistake in step 3 and step 5. Could you share other screenshots about that configuration?
Thank you!
Matt
07 12 2020
Hello Matteo,
Yes you are right, my mistake was at step 3.
I used the second scenario instead of the first scenario, its working now!
Thank you very much.
Matteo Zambon
07 12 2020
Great, nice to hear. Thanks Matt for your feedback 🙂
Buon Tag!
fabio
13 12 2020
Hi, MAtteo I am Fabio.
Pls specify scenario 1 and scenario 2, that is not clear to me.
At the end you show the results with the different steps and page view, to me it opens only 2 page views and passes me 8 errors. I followed your guide, but I can’t see what you see in debugging, despite using woocommerce and duracell
Matteo Zambon
15 12 2020
Hi Fabio, if you use Woocommerce you should use scenario case A. Could you share with me some screenshots?
Thank you
Daniel Velasquez
20 11 2020
Hi! “add_shipping_info event” need “shipping_tier” value.
How do I add this value?
Regards from Argentina!
Matteo Zambon
24 11 2020
Yep, you right.
add_payment_info need payment_type also. I will fix it with option parameters in EEC checkout and EEC checkout_option.
You will see and update in GTM variable in the next days
Polly
13 11 2020
Hi, thank you for the amazing guide! I have followed the steps, but I can’t make GA4 to show the value e.g. the price of the product which have been purchased. I’m confused where the problem may come from. Any help will be appreciated. Thanks in advance!
Matteo Zambon
13 11 2020
Hi Polly, sure. Are you sure that you have ecommerce.currencyCode in your variable? Check if you have these parameters in GA4 transaction debug:
Let me know, if you have problems, please contact me on LinkedIn 🙂
Francesco
10 11 2020
Ciao Matteo,
grazie della preziosa e dettagliata guida. Ho configurato correttamente i vari step da te indicati ed i vari TAG sono attivati in modo corretto.
Due problemi:
– Nella scheda in Tempo Reale vedo correttamente le 4 conversioni di test che ho effettuato ma nel rapporto Monetizzazione > Acquisti E-commerce non compare niente
– Come puoi vedere da questa immagine https://ibb.co/z6YN4sw non vengono correttamente passati i parametri da TAG Manager
Il sito web è con WooCommerce con plugin TAG Manager da te suggerito e nella sezione delle integrazioni con WooCommerce è tutto spuntato su attivo com suggerito.
Dove è saltato qualcosa?
Grazie in anticipo,
Francesco
Matteo Zambon
10 11 2020
Ciao Francesco e grazie del feedback. Trovi l’articolo in versione italiana qui: https://www.tagmanageritalia.it/come-tracciare-l-ecommerce-con-google-analytics-4-in-google-tag-manager/
Guardando il problema, sembra che le variabili dello step 3:
ecommerce.purchase.actionField.revenue
ecommerce.purchase.actionField.affiliation
ecommerce.purchase.actionField.coupon
ecommerce.purchase.actionField.id
ecommerce.purchase.actionField.shipping
ecommerce.purchase.actionField.tax
ecommerce.currencyCode
non abbiano dei valori. I motivi possono essere 2:
1) Hai sbagliato la configurazione delle variabili (attenzione maiuscole e minuscole)
2) Quei dati non sono passati nella transazione.
Per verificarlo ti basta vedere cosa c’è nel push del dataLayer nella transazione dell’EEC di Google Universal Analytics .
Fammi sapere!
Francesco
10 11 2020
Avevo erroneamente usato il prefisso “dlv -” nonostante stia testando questa configurazione con GA4.
Adesso i dati vengono passati e tramite TAG Manager è verificabile. Su Google Analytics ancora appare l’acquisto solo nei rapporti in Tempo Reale.
Può essere che visto l’attivazione di questa proprietà GA4 da solo qualche ora ancora non sia tutto attivo e funzionante? Anche per generici Eventi non vedo niente…
Saluti
Francesco
Matteo Zambon
10 11 2020
Su Google Analytics 4 devi attendere molte ore per vedere i dati odierni (eventi). Ti conviene verificarlo con: Tempo Reale di GA4 e la funzionalità nativa del Debug 🙂
Fammi sapere
Francesco
11 11 2020
Buongiorno, i dati sono finalmente apparsi ma non viene passato il valore dell’articolo in € nelle vendite la colonna dell’importo è zero. Dove posso/devo controllare per capire il problema?
Grazie
Matteo Zambon
11 11 2020
Ciao occhio alla variabile dlv. Controlla la configurazione che sia ecommerce.currencyCode
Francesco
12 11 2020
Avevo perso un pezzo inserendo ecommerce.currency senza Code di seguito e senza valore predefinito EUR. Ora dovrebbe andare
Matteo Zambon
13 11 2020
Ottimo!
Praba Ponnambalam
09 11 2020
A must-read article… thank you so much for the template & the article Matteo. Greetings from Sri Lanka 🙏
Matteo Zambon
09 11 2020
Thank you Praba! Your comment is really appreciated 🙂
Praba Ponnambalam
09 11 2020
Hi Matteo,
Thank.you so much for your reply, I really appreciate it.
I’m already using Tomi’s GTM4WP for my EEC on UA. Now trying to follow your guide to set up e-commerce on GA4.
On the EEC event trigger, there’s a conflict between Tomi’s documentation (https://gtm4wp.com/how-to-articles/how-to-setup-enhanced-ecommerce-tracking) & yours. I’ve put up a comparison chart to get this clarified from you 🙂
Screenshot: https://share.getcloudapp.com/Z4uy8BRA
Google sheet: https://bit.ly/32pNMYI
Appreciate your advice.
Thanks once again 🙏
Matteo Zambon
09 11 2020
Hi Praba, you just have to enter the exact name of the events you used. It depends on your plugin settings, so check what your events look like and set them with them 🙂
Praba Ponnambalam
09 11 2020
Hi Matteo, thank you so much for replying to my query. Now I got it, thanks once again 🙂
Matteo Zambon
09 11 2020
You’re welcome 🙂
Nuno Barreto
09 11 2020
Really nice article.
Thanks!
Matteo Zambon
09 11 2020
Thank you Nuno 🙂
Thắng
05 11 2020
Hello, How can I receive notifications for articles written in English from your blog? Thank you
Matteo Zambon
06 11 2020
Hi Thang, do it here: https://www.matteozambon.com/ on the footer 🙂
Thank you!