Abeer Sul
Abeer Sul

Reputation: 984

Why is google analytics not calculating revenue correctly?

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 it's rendered like this: enter image description here

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: enter image description here

And here are the logs showing that my store received 9 successful orders: enter image description here

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: enter image description here

And here is a screenshot from GA4 Admin settings also: enter image description here

Thanks

Upvotes: 1

Views: 1099

Answers (2)

michalnovacek
michalnovacek

Reputation: 299

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

Upvotes: 0

Shila Mosammami
Shila Mosammami

Reputation: 1067

Please check if you have marked this on: enter image description here

Upvotes: 1

Related Questions