Google Analytics trigger server side

Shopify Partner
1 0 0

Hi all

We are using GTM and dataLayer implementation in Shopify plus to improve Google Analytics implementation. This is implemented using Javascript. Hence, there is no reliability that code will always run. Discrepancy in Revenue is noticed when the datalayer implemented GA is compared to Shopify natively implemented google analytics (one available from preference settings). We are looking for ways to improve data collection. I read here

"the reason most analytics setups miss transactions is that they rely on a tracking code firing on the ‘thank you’ page. This might never trigger, maybe due to another slow running script on that page, or just that the customer navigates away after payment (knowing they will get an email confirmation).


What’s unusual about our solution is that we set up server-side tracking, rather than rely on any page load. So if the order is picked up by Shopify’s servers, and you get the payment, then we also send that on to GA – in a way that it can be linked with the pre-purchase behaviour."

I was wondering how this can be done? What logic we need to use in Shopify to achieve this and how the code will look?






Shopify Partner
36 1 5

You probably know Shopify provides webhooks for calling your backend when specific events happen like add-to-carts and purchases.
When your backend is called, your backend could send data to GA. Perhaps you would want to check out this manual


Just trying to help out.

We are web app developers, SEO ethousiasts, and do all kinds of other cool internet things.
Check us out at
New Member
2 0 0

Hi. Yes you can use, but how webhook understood source/medium transactions or clientId, for the match this transaction with users who do this transaction?