'gtag Purchase Event ignored on Google Analytics
I'm succesfully tracking some events with gtag.js on Google Analytics, with the exception of "purchase" event. Using GTM/GA chrome plugin I've checked that all events are tracked correctly, "purchase" included. The problem is that "purchase" is not tracked on Google Analytics: all the others are tracked ("begin_checkout", "add_to_cart" ...).
gtag("event", "purchase", {
affiliation: "Google online store",
coupon: "SUMMER_DISCOUNT",
currency: "USD",
shipping: 5.55,
tax: 3.33,
transaction_id: "T_1",
value: 28.86,
items: [
{
id: "P12345",
name: "Android Warhol T-Shirt",
coupon: "P12345_coupon",
list_name: "Search Results",
brand: "Google",
category: "Apparel/T-Shirts",
variant: "Black",
list_position: 3,
quantity: 1,
price: 9.99
},
{
id: "P12346",
name: "Flame challenge TShirt",
coupon: "P12346_coupon",
list_name: "Search Results",
brand: "MyBrand",
category: "Apparel/T-Shirts",
variant: "Red",
list_position: 5,
quantity: 1,
price: 9.99
}
]
});
The conversion/e-commerce graph is flat as you can see. What am I missing?

Update I've created a GAnalytics test account and the purchase event is tracked. On the screenshot's account, maybe, some configuration is missing: could be?
Solution 1:[1]
I had the exact same problem. Some things I noticed that could explain ut.
Date Range: Maybe you missed the fact that the date range in your Analytics report is set for 26 Oct - 1 Nov, while your events were triggered on 2 Nov?
Wrong Value Field: If the calculation of the value field is wrong (does not equal total of all items plus shipping field plus tax field) Google might ignore the event.
Processing Time: Even when the "Real-Time" view shows the events, they are not always included in other reports until some time later.
Solution 2:[2]
Interestingly I'm seeing something similar on my tests and I'm using some sample code off google:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-Y"></script>
<script nonce="djRFUUKP+SLF1k4qkKFqiLTO4Qo=">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-XXXXXX-Y');
</script>
<script nonce="djRFUUKP+SLF1k4qkKFqiLTO4Qo=">
gtag('event', 'purchase', {
"transaction_id": "24.031608523954162_C",
"affiliation": "Google online store_C",
"value": 0.01,
"currency": "GBP",
"tax": 1.24,
"shipping": 0,
"items": [
{
"id": "P12345C",
"name": "Android Warhol T-Shirt",
"list_name": "Search Results",
"brand": "Google",
"category": "Apparel/T-Shirts",
"variant": "Black",
"list_position": 1,
"quantity": 2,
"price": '0.01'
},
{
"id": "P67890C",
"name": "Flame challenge TShirt",
"list_name": "Search Results",
"brand": "MyBrand",
"category": "Apparel/T-Shirts",
"variant": "Red",
"list_position": 2,
"quantity": 1,
"price": '3.0'
}
]
});
</script>
We use nonce because we are using CSP and believe all CSP urls are set correctly in the CSP.
Any insight would be a great help as to why this would not be logging this transaction data.
Solution 3:[3]
For Item Data:, id should be the transaction ID.
See here:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#item
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ipodppod |
| Solution 2 | Stuart Palmer |
| Solution 3 | ouflak |
