GA4 deduplicate with same transaction id?

Hi,

If i send GA4 Purchase event and also a webhook purchase event, with same transaction id, client id, session id, items etc - does GA4 then automatically deduplicate it, so we dont get double tracking on the purchase event?

No, there is no deduplicated system in GA4 like Meta, Tiktok, Pinterest etc.

can i ask you have you handle deduplication with ga4 purchase event and sending a webhook from cms as well? I am storing the transaction id in Stape store from the ga4 purchase event, but unsure what to do from here,

No I haven’t. Because you should send purchase event only from one source. Otherwise it will show duplicate purchase event in you GA4 property which you should avoid. GA4 DOES NOT SUPPORT DEDUPLICATION.

Yes, but how do i handle so my webhook doesnt fire if the ga4 purchase event comes in the server? When we cant pick up the purchase event on clientside, the webhook needs to fire instead

I’m not sure if this what you want to achieve.

You can utilize stape store feature.

You can store transaction id in stape store when GA4 purchase event is received in server GTM.

Then when the webhook is triggered from the CMS, first it should check if that transaction_id already exists in the Stape store.

If the transaction_id already exists then webhook will not fire to GA4. If transaction_id doesn’t exist in the stape store then you can fire the webhook and then again store the transaction id to stape store to prevent future duplication.

@Md_Monirul_Islam described good solution for this.

You also need to take into account that the webhook should be sent with a delay to allow time for tags to work, to be written to the database, etc. Otherwise, the webhook may arrive before the web event.

Also don’t forget that the webhook should have the user id and session id from the user cookie so that the event is bound to the user and session.

1 Like

Yes, thank you both! This is what i am doing. I guess i can delay the webhook with firestore delay tag?

Also i would need to send items array with webhook to ga4 right? I have stored client_id and session_id, so i can send that as well