I researched and tried all I know to fix the GA4 tracking but I can’t seem solve it.
GA4 is not handling my tickets for more than a month.
In my website, users make purchases and I want to show accurate revenue in GA4, in SAR currency.
I use this code for successful orders:
if(( typeof gtag !== 'undefined')){
gtag("event", "purchase", {
transaction_id: "{{$order->paymentid}}",
affiliation: "My Store",
value: +('{{$theTotal}}'.replace(',','')),
tax: {{$order->vat}},
shipping: {{$theShipping}},
currency: "{{$order->currency}}",
coupon: "{{$order->coupon_code}}",
items: temp
});
}
and when I check GA4 dashboard, I find 0 revenue or a single revenue out of more than 10 orders. Although my client-to-server logs prove that they all succeeded.
Here is a screenshot from GA4 on a specific date:
And here are the logs showing that my store received 9 successful orders:
Can you tell me why GA4 takes a single or none "purchase" events and ignores the rest?
EDIT:
To clarify more, here are the tags I have in the head:
And here is a screenshot from GA4 Admin settings also:
Thanks
2
Answers
Please check if you have marked this on:
Your parameter
transaction_id
is not populated. It is mandatory to populate this parameter when you are sending purchase event.Please see more here https://developers.google.com/analytics/devguides/collection/ga4/reference/events#purchase