I am having a problem with duplicated data in the Firestore DB and my online store
This is how things are set up at them moment.
- The user enters items into the basket on the website and then views the basket.
- Basket details get passed from WebGTM to SSGTM using stape data server/client.
- SSGTM writes into firestore db with basket details adding sessionID as a reference point and writes a cookie so we can access the basket data on checkout as the basket isn’t available to webgtm on the purchase event.
- On purchase, webGTM sends order data to SSGTM and SSGTM retreives basket details from firestore DB in a variable using the sessionID from the webGTM.
The problem is that, if the basket is updated a new document with the same sessionID is created, rather than the original being updated in the Firebase
Does anyone have any ideas? - there may be a much better solution to this too! I am open to suggestions.
Thanks