Shopify App Purchase Webhook to sGTM

Hey everyone,

I hope you’re doing well. I’m currently using the “Stape Server GTM” app on my Shopify store. My setup involves sending events to the browser GTM, and specifically, I’m sending only the Purchase event to the server GTM via webhook. The good news is that I’ve managed to get everything properly configured and up and running.

In my server GTM preview, I can successfully observe the webhook requests coming through.

Now, here comes my query. I’m wondering how I can efficiently pass cookies via the webhook. Specifically, I’d like to pass the values of cookies such as _ga, FPID, _gcl_au, _fbp, and _fbc to my server GTM via the webhook. The purpose behind this is to seamlessly set up tags like Google Analytics 4, Google Ads, and the Facebook Conversion API for the “Purchase” event tag, all from within the server GTM using the data received via the webhook.

I’m eager to learn and implement this step, and I’d truly appreciate any guidance or insights you can provide. Your expertise means a lot to me, and I’m looking forward to your suggestions.

Thank you so much in advance!

Best regards,
Annie Smith
Marketing Technology Coordinator at “360 Marketing Agency”

Webhooks sent by the app do not carry cookie information unfortunately

Is there a way to include cookie data?

not with webhooks from our app.

what you can try is native shopify webhooks, but then you’d have to populate for example order metadata with cookie information on your own, so that it’s then available in the webhook. by default there will be no cookie information neither

Would it be possible for you to offer some instructions or direct me to resources on how to ‘populate order metadata with cookie information’ using native Shopify webhooks?

I’m eagerly anticipating your assistance. Thank you!

Hey Annie,

On second thought, the proposed scenario wouldn’t really work. To add stuff to metafieds of the order, that order must already exists, which means that any associated webhook for it would already have fired. Not to mention that you need to have tracked that order (order_id) in the first place to manipulate it, which kind of kills the purpose.

Hypothetically, you could add some hidden fields on checkout (Shopify won’t allow it most-likely though) so that order metafields are populated with cookie info in the first place.

No simple and direct answer here, as you can see :slight_smile:

Dan