The problem.
Proposed Solution.
- A web tag sends event data to sGTM.
- In sGTM, event data along with click identifiers is written to either Stape Store or Firestore database. Upon successful write operation, a unique document ID is returned.
- An HTTP cookie is set containing the document ID.
- After receiving the database response, an event is pushed to the dataLayer. (Stape’s data tag has this functionality.)
- The dataLayer event triggers JavaScript that updates all WhatsApp links on the page, appending a personalized message with the reference ID. Example message: “Hi, I want to book an appointment. Reference ID: {{1st Party Cookie Variable}}”
- The user clicks the modified WhatsApp button and sends the message containing their reference ID.
- A WhatsApp webhook… The rest you all know.
Additional notes.
Many advertisers implement a variation that only writes data to the database when the user clicks the WhatsApp link. The click goes to a webhook, the event data is saved, and the user is redirected to WhatsApp with the reference message. I tested this approach using Cloudflare Workers and found it slower than I would like. I prefer using a page view trigger that fires only while the 1st Party Cookie Variable is undefined. Once the document ID has been written and stored in the cookie, the trigger no longer activates.
It would be very helpful if Stape offered native WhatsApp integration inside the dashboard for paying users. The WhatsApp Cloud API now supports Coexistence, which allows the same number to run on both the Business App and the API. For now, advertisers can set up the webhook by themselves, but Stape could eventually streamline this workflow as a WhatsApp API Tech Provider.
This setup is technically already possible using Stape’s data tag in Web GTM, Stape’s JSON Response tag in sGTM, and some JavaScript. But an official, supported solution would be better.
Thank you.