How to setup GTM Server Side on Shopify - Stape

How to setup GTM Server Side on Shopify

Shopify provides native Google Universal Analytics integration. It works perfectly on all subscription plans. More info and how to set up Google Analytics on Shopify you can find on their official documentation. Also, you can add a GTM web container on all pages of your website if you have Advanced Shopify or Shopify Plus plans. If you are using “Basic Shopify” or “Shopify” plans, you can only add scripts on not checkout pages.

And here is the problem, “Advanced Shopify” costs $299 per month while “Basic Shopify” costs $29 per month, and if the Basic plan is enough, you don’t want to pay more only for adding a GTM Web container to the checkout pages.

Shopify allows changing “transportUrl” in GA settings. It means that you can set up a Google Tag Manager Server container on Shopify instead of a GTM Web container. I hope that this will help you solve all your tracking problems.

How to send events to Google Tag Manager Server Side from Shopify

    1. First of all, you need to create Google Tag Manager Server Side Container.
    2. As an option, you also can set up your domain for GTM SS. It will help you track users more accurately.
    3. Now you need to set “transportUrl” in your Shopify account. Go to Online Store -> Preferences and find Google Analytics settings. Then click on “Add custom JavaScript” and set this code where “” is your GTM SS URL.
ga('set', 'transportUrl', '');
Shopify GTM Setup
Setting transport url for GA in Shopify
  1. Now you can check that the GA library on your site started to send events to your Google Tag Manager Server Side container.
Check request go to GTM Server Side on Shopify
  1. In some rare cases, the “pageview” event sends faster than the “transportUrl” setting applies. And the event does not go to GTM SS. If you have this problem, add this event after the “transportUrl” setting:
    ga('send', 'pageview_confirmation');

    this will help you measure more accurately.

Add pageview event got GA on Shopify

I hope this guide will help you solve Shopify tracking issues. If you still experience any of them, our team is always available for a consult. All you need to do is describe the problem, and we will help you find the solution.

If you want to test what the GTM server is and how it works, please register an account.

If you need help setting up a GTM server account on your website, contact us right away!