I want to understand how to properly enrich conversion data with Stape Store / Firestore and send it to the Ad Networks. Let’s say I have 3 events in my funnel: PageView, Lead and Purchase.
Let’s say my Lead event has this data:
This data gets stored in Stape Store / Firestore with the Writer Tags, the moment this webhook is received in the server container URL.
Let’s say a Purchase event happens afterwards and the type of GET call to the webhook that I get is this one:
And so, by using the {user-id} parameter I want to be able to locate the document / event in Stape Store / Firestore, and create a new webhook to send the data related to the Purchase event.
This new webhook will be similar to the Lead webhook, but with more data, basically, adding transaction data:
How can I properly implement this? When should I use the variables: “Stape Store Lookup” and “Stape Store Restore” (or the Firestore equivalent variables)?
you answered it yourself here, I assume your user-id here would be the stitching agent, so you need to store data under that user-id key, and upon receiving a webhook use a lookup variable to pull whatever it is you got stored there
Ok, so with the “Firestore (Writer)” tag I will write the data of the Lead event to the DB. Then when I receive the webhook for the Purchase event, I will use the “Firestore (Lookup)” variable to search for the record corresponding to the “user-id” in the DB.
But then, once that record is found matching the user-id, how is the process of merging data and resend the webhook with all the data to the server container URL (and therefore to the corresponding Ad Network tags)?
Also, in which situation should I use “Firestore (Restore)” variable?
Ok, so with the “Firestore (Writer)” tag I will write the data of the Lead event to the DB. Then when I receive the webhook for the Purchase event, I will use the “Firestore (Lookup)” variable to search for the record corresponding to the “user-id” in the DB.
correct
But then, once that record is found matching the user-id, how is the process of merging data and resend the webhook with all the data to the server container URL (and therefore to the corresponding Ad Network tags)?
you populate whatever tags you want to fire on the webhook with lookup variables that return the data you need
Also, in which situation should I use “Firestore (Restore)” variable?
I am currently setting this up. I kind of understand how this should work, but I still have some doubts about the setup. Let’s say my webhook GET call looks like this:
I am using the “session_id” as the document key to store previous webhook data associated with this session. This is what a Firestore Lookup variable looks like:
How can I tell the system to grab the “session_id” value from the webhook GET query parameter, and use that value to find the Firestore document with its document key, that session_id value?
Ok, that was the key of the puzzle that I was missing. So I managed to make it work with those instructions.
Now, how can we have a tidy & clean Firestore database? Is there a way to delete “documents” from a “collection” in Firestore once a document has been “used” by a Tag in GTM? Or maybe after X amount of days?
The idea is not to fill up the database with documents that we no longer need it or that they have been already used.