I have made a GA4 property to pair with my Universal Analytics but I'm having difficulties with the set up of the ecommerce events.
I have read this Official Guide made by google in order to correctly configure the parameters of the event since the datalayer structure for GA4 is slightly different.
My data layer for the purchase has the following structure:
{
"event": "purchase",
"ecommerce": {
"currencyCode": "EUR",
"purchase": {
"actionField": {
"id": "XX7000294103",
"affiliation": "",
"revenue": "97.8000",
"tax": "0.0000",
"shipping": "0.0000",
"shipping-term": "3 day shipping",
"payment-term": "msp_cashondelivery2",
"action": "purchase"
},
"products": [
{
"name": "Product Name",
"id": "7263",
"price": "89.90",
"quantity": 1,
"dimension2": "available",
"dimension3": "0%"
}
]
}
}
}
and my purchase event has the following structure:
TAG TYPE: Google Analytics: GA4 Event
EVENT NAME: purchase
EVENT PARAMETERS:
Parameter Name
items: {{items}
transaction_id: {{Transaction_ID}}
currency: EUR
value: {{transaction_revenue}}
TRIGGERING
Custom Event
Event name
purchase
This Trigger fires on
All Custom Events
Event Name: purchase
|
|
|
|
|
|
Variables:
{{transaction_revenue}} -> DATALAYERVARIABLE
ecommerce.purchase.actionField.revenue
{{Transaction_ID}} ->
DATALAYERVARIABLE
ecommerce.purchase.actionField.id
{{items} -> EEC Products -> GA4 Items (taken by the templates made by simo ahava)
I have made so far these events:
add_to_cart 🟩 Working
purchase 🟥
checkout 🟥
product_click 🟥
remove_from_cart 🟥
Any idea why in GA4 I can only see the items added to cart but no purchases?
Related
I am trying to implement the GA4 view_item Event in BigCommerce. The data is populating correctly in the source code but when I check that event in GA4 Debug View, it doesn't show this event.
I also checked the Network Tab payload in Chrome Dev Tools and that is also not showing any event.
Here's the output in the page source.
<script>
gtag("event", "view_item", {
currency: "USD",
value: parseFloat(2.4),
items: [ {
item_id: "9781645072485",
item_name: "Alongside Jesus: Devotions for Teenagers",
currency: "USD",
discount: parseFloat(16.99),
item_brand: "Drew Hill",
price: parseFloat(2.4),
quantity: 1,
item_category:"Teen/Teen Books"
}
]
});
</script>
I had already tried to implement the configuration needed by following this video :
https://www.youtube.com/watch?v=IjyX6g2sZpk&ab_channel=TheSearchAgency
here is my datalayer :
<script>
var dataLayer = window.dataLayer || [];
dataLayer.push({
"event": "transaction",
"ecommerce": {
"purchase": {
"actionField": {
"id": "14c26747-503e-498c-a9b4-604fe1a479d1",
"affiliation": "Online Store",
"revenue": 41,
"tax": 5,
"shipping": 5
},
"products": [{
"id": "7w9e0",
"name": "Masons T-Shirt",
"price": "31.00",
"brand": "Masons",
"category": "T-Shirts",
"variant": "red",
"dimension1": "M",
"position": 0,
"quantity": 1
}]
}
}
});
</script>
Until now i was able to receive the same datalayer in my google tag manager :
Datalayer received in GTM Preview
and here is the config of my tag :
GTM CONFIG
My problem is that i can't see any data in the google analytics ecommerce overview, even if i waited more than 48 hours.
Check the network requests, see if you're sending your EEC data to the ?collect endpoint.
Check your debugging preview, see if the EEC event has fired exactly on the event you expect it to (transaction)
Check your property/measurement id. Make sure it's the same in GA and in GTM. And in the Network tab.
Confirm that you're using GA UA events everywhere.
If I'm using GTM to track ecommerce purchases, what do I set the data layer variable in GTM for the purchased items' properties? Take this, for example:
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "T12345",
affiliation: "Online Store",
value: "59.89",
tax: "4.90",
shipping: "5.99",
currency: "EUR",
coupon: "SUMMER_SALE",
items: [{
item_name: "Triblend Android T-Shirt",
item_id: "12345",
price: "15.25",
item_brand: "Google",
item_category: "Apparel",
item_variant: "Gray",
quantity: 1
}, {
item_name: "Donut Friday Scented T-Shirt",
item_id: "67890",
price: 33.75,
item_brand: "Google",
item_category: "Apparel",
item_variant: "Black",
quantity: 1
}]
}
});
If I want to track item_brand then do I just create a variable ecommerce.items.item_brand? Even though items is an array?
You're looking at GA4 tracking.
Make sure you're really using GA4. Here is the syntax for UA: https://developers.google.com/tag-manager/enhanced-ecommerce#purchases
I'm noting it because GA4 is still under development and has very limited capabs comparing to UA.
Take a look at this article here: https://marketlytics.com/blog/pull-ecommerce-data-from-datalayer-gtm/ it indicates how you can pull the data through the DLV vars in GTM.
Surely, you can always pull the data using a custom javascript variable like so:
function(){
return dataLayer.filter(function(obj){return obj.event === "purchase"})[0].ecommerce.items;
}
It will return the items array though. You probably wanna set up the logic of getting the brand. Not sure what item you want to grab the brand of though, but you have a freedom to do whatever starting from here.
I writing the code to track Enhanced E-commerce with the gtag library. The impression of products hit sent when the page load and on clicking the Add to Cart button I sent add_to_cart event. But it gives me this error
analytics_debug.js:23 Command ignored. Plugin "ec" has already been required on tracker.
Here is my code
gtag("event", "add_to_cart", {
"items": [
{
"id": "2",
"name": "Hoodie",
"category": "cloth",
"quantity": "2",
"price": "16"
}
]
});
I'm using Google Tag Manager to implement Google Analytics. I couldn't be able to have e-commerce data.
I'm sending the ecommerce data within the dataLayer object:
dataLayer = dataLayer || [];
dataLayer.push({
PageType: "Confirmation",
ProductID: "2222",
ProductGroup: "",
ProductName: "Test1",
CheckInDate: "2017-09-10",
CheckOutDate: "2017-09-11",
NumberOfAdults: "2",
NumberOfChildren: "0",
NumberOfRooms: "1",
NumberOfNights: "1",
TransactionID: "11111",
Revenue: 60.00,
Destination: "London",
Event: "Purchase",
'transactionId': "11111",
'transactionAffiliation': "Test1",
'transactionTotal': 60.00,
'transactionProducts': [{
'sku': '2222',
'name': 'Test1',
'category': 'Hostel',
'price': 60.00,
'quantity': 1,
}]
});
This object is created before tag manager snippet.
In Google Tag Manager I have only one tag that fires all pages and track type is Page View. I didn't add another tag for transaction since the object occurs before snippet. Enhanced Ecommerce Features is not enabled (I tried when it's enabled but didn't change anything.
In Google Analytics I have enabled Ecommerce but Enhanced Ecommerce.
Dimensions that I have except ecommerce are mapped but ecommerce variables are not.
What should I do to make ecommerce work properly? What do I missing?
The code works properly with the configuration.
What you have to do is create the tag of transaction, this because the dataLayer used is for standard ecommerce and with that technology the transaction hit is send separated. (In Enhance ecommerce this info is send on attached to another hit).
So in this case doesn't matter if the data is pushed before or after the pageview, because is sent with their own trigger.
Greetings