Session attribution for purchase webhook

I need to create a custom sGTM tag for affiliate tracking, but am unclear how I can access the necessary affiliate referral source when relying on the purchase webhook.

I need access to either the landing page query string parameters or session cookies when capturing events via webhooks; however, neither of these seem to be available with the standard ‘data client’ or available via Shopify’s Admin GraphQL (if I create my own Shopify app).

I appreciate any suggestions.

Hi Curt,

I will duplicate here what I wrote to you in the email, maybe it will be useful for someone else:

If you don’t have the possibility to add to the standard webhook the necessary click id which is usually stored in a cookie, it can be configured like this:

  • The click id is stored in the user’s cookie as soon as the url contains the required query with it.

  • After add to cart or after begin checkout event in Firebase (usually the easiest option to connect) is sent a click cookie value and any ID by which you can identify the user at the stage of purchase and it is accessed in the webhook (for example cart_id).

  • When a purchase is made, you send a standard webhook to the server container, from there an ID is taken which is used to find the required click id in Firebase, from this an event with all the necessary data and click id is mapped and sent to the required platform.