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

Hey there,

We developed a proof of concept (PoC) for Shopify that enables us to pass cookie values via the native purchase webhook on test webshop. It’s done via ajax (cart.js) API. My question is whether simply passing the cookie value to Google Ads and Meta Ads through the webhook trigger is sufficient for conversion tracking.

@Dan any advice?

1 Like

If you send them as native Cookie header - nothing needs to be done for Meta/FB.

Google Ads will never function properly off of webhooks, regardless of whether you have cookies there or not, Google Ads tag expect a fully formed incoming gtag hit and rely on a lot of data within it.

2 Likes

Hi,

Could you please share your method or code so that I can use it to send the cookie value via the webhook?

Thanks,
Sharif