
Whether you're improving your Shopify SEO, planning your next marketing campaign or segmenting customers, you need data. Accurate data, which becomes harder to get with the modern website setups.
The ad blockers and browser limitations often lead to missing conversions and other data in your GA4. This leaves you wondering whether you can still get accurate data reports in 2025.
You can. You just need to switch to server-side tracking. So today you'll learn how to set up server-side tracking in Shopify, using the
.1. Create GTM Server Container
Go to your GTM account and choose the Create Container option once you click on the three dots near your property.
Fill out the Container Name, select Server as a Target Platform, and hit Save.
You need to create a new project on the Google Cloud Platform to host your server container somewhere. Just choose the Automatically Provision tagging server option here (it's much simpler than creating a new project manually).
Then you need to create a billing account and fill out your card details (if you haven't used the Google Cloud before). Hit the Create a Billing option to complete the steps here.
Note: it's important to specify that the GTM server-side container is free. It doesn't cost anything in the testing configuration. However, once you start using it on the live website with decent traffic you'll be charged. That's why you need to specify your billing details at this point. Read more about the Google Cloud pricing to clarify the details.
2. Get GTM Server Container Details
Once you set up the GTM server container you'll need to grab some data about it for the GTM integration in Shopify.
Get GTM public ID, account ID, container ID
These are the GTM server container details you need to connect it to your Shopify store.
- Public ID — get it in the container Workspace tab (top right menu).
- Account ID — get it in the container browser address after /accounts/.
- Container ID — get it in the container browser address after /containers/.
Get tag server URL
The next thing you need to grab for the GTM server tagging is the server URL. Navigate to the Admin tab while in the GTM account and click on the Install Google Tag Manager option. Then copy the Default URL.
Don't close the GTM server container, you'll need this tab later.
3. Fill out Container Details in Shopify
Now it's time to establish a connection between your server container and Shopify. Go to Apps > GTM & GA4 - Magefan > Configuration and find the Server Container section.
Here you need to paste the data you've collected in the previous step into the corresponding fields.
Save the settings at this point.
4. Connect Google Analytics 4
To view collected data in the GA4 reports you need to connect it to your Shopify store. For that, get the GA4 measurement ID.
First, navigate to the GA homepage and choose the GA4 property. Then move to Admin (gear icon) > Data Streams > Web stream details and copy your Measurement ID.
Once you get it, go back to your Shopify admin (Apps > GTM & GA4 - Magefan > Configuration > Google Analytics 4). Enable GA4 there, paste the copied Measurement ID and Save the settings.
At this point, you have everything you need to start tracking data with GTM server container. You just need to export the GTM container (step 6).
However, if you also manage Google Ads and want enhanced conversion tracking there, keep reading.
5. Set up Google Ads Conversion Tracking and Remarketing (Optional)
GTM & GA4 App by Magefan offers you enhanced conversion not only in Google Analytics 4. You can also set up Google Ads Remarketing and Conversion Tracking (+Enhanced). For that you need to fill out additional data in the app settings.
Get Google Ads Tag ID, conversion ID and label
First, navigate to your Google Tag settings > Tools > Data Manager and click Manage near your Google Tag. Then click on Your Google Tag and find the Tag ID under the Tag details.
Now, let's get the conversion ID. Go to Google Ads account > Tools > Shared Library > Audience Manager > Your Data Sources > Details in the Google Ads tag card.
Scroll down to the Tag setup section and switch to the Use Google Tag Manager tab. That's where you get your Conversion ID under the Instructions.
Note: the conversion label is required for conversion tracking.
Navigate to Goals > Summary and choose a corresponding action (we use Purchase here).
Note: just hit +New conversion action button to create an action you'd like to track on your store (if you don't have any actions here).
Then go to the Tag setup > Use Google Tag Manager to find a Conversion Label.
Paste the Google Ads details in the admin
So, we're back in the GTM & GA4 app settings (Apps > GTM & GA4 - Magefan > Configuration > Google Ads). First of all, paste your Tag ID here.
Then enable Conversion Tracking and paste Conversion ID and Label correspondingly.
If you also want to use the Google Ads Remarketing option, paste the same data in the Remarketing section.
Save the setting and you're good to move to the next step.
6. Export Pre-Built GTM Container
Once you fill out all the data, we build the GTM data layer for you. Just scroll down to the Export Server Container section and click the corresponding button. The container JSON will be downloaded to your device after a few seconds.
7. Import GTM Container to Your Account
Then go back to the GTM account, switch to the Admin and find the Import Container option.
Select a file to import, choose workspace (usually default) and set whether to overwrite or merge a selected workspace with a selected container.
You can also preview new, modified and deleted GTM tags and then Add them to workspace.
Once you finish, find all the tags under the Tags in your GTM Workspace tab.
8. Check GTM Server Container Integration
After you import the pre-built data layer to your GTM account, all important eCommerce events will be tracked. However, you can also test the connection using the built-in tool or Google Analytics 4.
Test GTM Server Container via Server Container
Things are a bit simpler with the web container. You can just do a preview and see all the actions tracked in your store. However, server-side doesn't work that way. First, you need to get your Server HTTP Header.
For that go to your GTM account again and hit the Preview button. Then, choose the Send requests manually option.
Copy the X-Gtm-Server-Preview HTTP header in the popup and move to your admin. However, don't close this preview tab.
Navigate to the Server Container section and enable the Debug View/Preview. Then paste your X-Gtm-Server-Preview HTTP Header and IP there.
Save the settings and go back to the GTM preview tab. Then simply open your website in a separate tab and browse through it.
This should trigger some events signaling that your GTM server container is set up properly.
Test GTM Server Container via Google Analytics
The other way to test whether GTM server container is working properly is through GA4. Just navigate to your GA4 property > Reports > Realtime and find the events triggered in your store within the last 30 minutes.
Note: it's common for GA4 to delay the display of events, especially with the server-side tracking. Don't worry if you don't see the events you triggered there immediately.
The primary reason for setting up server-side tracking in Shopify is not just data accuracy. This tracking method is more SEO and performance-friendly since there is no script loading with each page visit.
This means no loading delays or interruptions to the user experience.
But that's not the only difference between server-side and client-side tracking. Server tracking gives you more control over the data sent to the tracking channels and more flexibility. Give it a try and you'll see the difference it makes.