How to Set Up Server-Side Tracking in Shopify

By Duncan from MultiPixels| July 10, 2025

Server-side tracking is a method of data collection and sending from the server rather than from the user's browser. Traditionally, a website uses client-side tracking and this involves snippets of JavaScript - such as those from Google Analytics or Meta Pixel - that are embedded into a webpage.

Illustration showing server-side tracking process with web browser sending data to cloud servers and analytics dashboard, highlighting accurate data collection and conversion tracking for Shopify and ecommerce

These scripts collect user activity such as clicks, page views, purchases, etc, and send that data to analytics and advertising platforms. However, client-side tracking is becoming increasingly limited. With Ad blockers, browser privacy settings and restrictions on regulations such as GDPR, the reliability of browser based data collection has been limited. Server-side tracking addresses each of these issues by transferring the data collection logic to a secure, first-party server environment. Instead of relying on a browser to collect and transmit data, server-side tracking collects the data in your backend system, transmitting it directly to platforms like Google Analytics 4, Meta’s Conversion API or TikTok’s Events API.

This method not only bypasses the browser-imposed limitations en masse, but also allows for more secure handling of user data, better control over cookies and better, more accurate measurements of conversions.

Why Server-Side Tracking Matters for Shopify

Shopify merchants are increasingly struggling with reduced visibility into customer behaviour and conversions. This is largely due to modern privacy regulations and the technical limitations imposed by client-side tracking. For a business that heavily relies on digital advertising, every piece of missing data point translated into potential revenue losses. Server-side tracking helps to solve this problem in the following ways:

Improved Data Accuracy

Client-side scripts are vulnerable to ad blockers and browser limitations which often results in incomplete data. Server-side tracking bypasses these issues, ensuring more reliable event tracking and performance reporting.

Faster Page Load Speeds

When heavy tracking scripts are removed from your storefront, and the data processing has been efficiently offloaded to the server, server-side tracking leads to faster page load times and a smoother, better user experience.

Extended Cookie Lifespan

Server environments can manage first-party cookies with more flexibility, often extending their lifespan compared to browser-managed cookies. This supports better attribution, especially for repeat or delayed conversions.

Better Conversion Attribution

Server-side events are far less likely to be lost or misattributed, which allows platforms like Facebook Ads or Google Ads to more accurately connect sales to campaigns. This is critical for ad spend optimization.

Stronger Compliance Capabilities

For better control over user content, data retention and regulatory compliance, handling data server side is a better idea. This is important for regions governed by CCPA and GDPR.

When it comes down to it, server-side tracking gives Shopify merchants a strategic advantage in performance measurement, advertising optimization and legal compliance.

Shopify Server-Side Tracking Options

While Shopify doesn't offer native server-side tracking support, you can integrate it using third-party platforms and services. Some of the most common methods include:

Stape.io

Stape is a popular hosted solution for server-side Google Tag Manager containers. It’s beginner-friendly, cost-effective and requires no setup of infrastructure. It supports G4, Meta CAPI, TikTok and more..

Google Cloud (Self-Hosted GTM Server)

Advanced users can set up a custom GTM server container hosted on Google Cloud Platform (GCP), AWS or another cloud provider. This gives you the maximum privacy and control you need while also giving you ongoing server maintenance.

Shopify + GTM via Apps

Shopify - so far - doesn't allow direct GTM script injection in some themes, but apps like Elevar or Analyzify bridge that gap. These apps let you implement both client- and server-side GTM contains without needing to edit theme files.

Third-Party Platforms

Tools like Elevar, Analyzify and Littledata offer turnkey Shopify server-side tracking integrations. These platforms often bundle their consent management, deduplication and multi-channel support into one handy interface.

Step-by-Step Setup (Example with Stape)

To demonstrate how server-side tracking works in Shopify, we’ll walk through a typical implementation using Stape.io, one of the most popular hosted solutions.

Step 1: Create a Stape Account

  • Visit Stape.io and sign up.
  • Choose a pricing plan based on your expected traffic volume and support needs.

Step 2: Create a Server Container in GTM

  • Log in to your Google Tag Manager account.
  • Click “Create Container,” choose “Server” as the container type.
  • Download the container configuration file (used in deployment).

Step 3: Deploy the GTM Container on Stape

  • In your Stape dashboard, select “Add New Server Container.”
  • Upload your GTM configuration file.
  • Select a custom subdomain (e.g., gtm.yourstore.com) and server location.
  • Stape will provide a server URL used to connect client- and server-side containers.

Step 4: Link Web and Server Containers

  • In your web GTM container, set up a Tag that sends event data to your server container.
  • Use a variable to reference your Stape server URL.
  • In the server container, add a Client to listen for incoming data and route it to the appropriate tags.

Step 5: Add Tags for Analytics and Ads

  • Within the server container, create tags for:

    • GA4 using Measurement Protocol
    • Meta using the Conversion API
    • TikTok using their Events API
  • Configure triggers for each tag based on events (purchase, page view, add-to-cart).

Step 6: Test Your Setup

  • Use GTM’s Preview mode to validate both containers.
  • Check Stape logs and network requests in DevTools.
  • Compare analytics reports before and after implementation.

Server-Side Tracking for GA4, Meta, and TikTok

Google Analytics 4 (GA4)

GA4 uses the Measurement Protocol, which lets you send server-side events directly to Google’s servers. You’ll need:

  • GA4 Measurement ID
  • API Secret (generated in GA4 Admin > Data Streams)

In GTM Server container:

  • Create a GA4 tag.
  • Input the Measurement ID and API Secret.
  • Map incoming data (event names, parameters) to the appropriate format.

Meta (Facebook) Conversion API (CAPI)

Meta’s CAPI allows you to send user activity directly from your server to Facebook, improving data quality and event match rates.
You’ll need:

  • Pixel ID
  • Access Token (from Events Manager > Settings)

In GTM Server:

  • Use the Meta tag template or set up a custom HTTP request to Meta’s endpoint.
  • Include parameters like event_name, event_time, user_data, and custom_data.

TikTok Events API

TikTok’s Events API functions similarly to Meta CAPI. You’ll need:

  • Pixel ID
  • Access Token

Use GTM Server to:

  • Create a custom tag that sends events to TikTok’s API.
  • Include user identifiers and conversion metadata.

All three platforms support event deduplication using an event_id, helping prevent double-counting when using both client and server events.

Privacy & Consent Compliance

As you collect and process user data, maintaining compliance with privacy laws is non-negotiable. For GDPR in the EU, this requires explicit consent for tracking and data collection. Users have to be able to opt out at any time. The CCPA in California requires disclosure of data usage and then opt out option for the sale of personal data.

Shopify Policy

Shopify mandates that merchants collect user consent before enabling any tracking scripts or technologies.

Best Practices

  • Use a Consent Management Platform (CMP) like Cookiebot, OneTrust, or Consentmo.
  • Store consent decisions in a cookie or dataLayer variable.
  • Only trigger server-side tags when consent is present.
  • Pass consent data to the server so GTM can conditionally send events.

Common Issues & Troubleshooting Tips

1. Events Not Firing

  • Confirm that the correct Access Tokens and IDs are used.
  • Check DNS setup and SSL certificates on your tracking subdomain.
  • Validate GTM container permissions and tag configuration.

2. Duplicate Conversions

  • When running both client-side and server-side tracking, use a consistent event_id to deduplicate.
  • Platforms like Meta have built-in deduplication logic when both sources send the same ID.

3. Poor Attribution or Matching

  • Make sure user_data includes hashed email, IP address, phone number, etc.
  • Ensure data is normalized and privacy-compliant.

4. Debugging

  • Use GTM Preview Mode in both Web and Server containers.
  • Use the Network tab in DevTools to trace outbound requests.
  • Review request logs in Stape to troubleshoot payloads and errors.

Hosted vs. Self-Hosted Server-Side Tracking: An In-Depth Comparison

When implementing server-side tracking in Shopify, one of the most important decisions you'll make is whether to use a hosted solution such as Stape.io or build a self-hosted setup,

Ease of Setup

Hosted solutions like Stape are designed to be plug-and-play. Once you sign up, you typically just upload your GTM server container, choose a custom domain, and connect your Shopify store. You don’t need to deal with server configuration, security patches, or SSL certificates. This makes hosted services ideal for merchants without technical backgrounds or developers on staff.

Self-hosted server-side tracking involves setting up your own server environment - often on platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), or Vercel. You’ll need to configure a virtual machine, manage domains, install SSL certificates, handle server updates, and ensure scalability. While this provides greater control, it’s time-consuming and requires advanced technical skills.

Cost and Budget Considerations

Hosted solutions operate on a predictable monthly subscription model. For example, Stape’s plans range from free (with limited features) to enterprise-level pricing, depending on request volume and support level. This makes budgeting straightforward and removes surprises from unexpected usage spikes.

Self-hosted environments, on the other hand, incur variable costs based on server traffic, storage, compute power, bandwidth, and external services. While you can potentially optimize costs over time (especially at scale), you’ll need to closely monitor usage and configure resources to avoid ballooning expenses.

Maintenance and Reliability

Hosted tracking platforms manage everything on your behalf: uptime, monitoring, updates, backups, and scaling. If something breaks, their support team is on standby. This is ideal for Shopify merchants focused on business operations rather than infrastructure.

With self-hosted setups, you are the system administrator. You’re responsible for ensuring that the server is up 24/7, patching vulnerabilities, scaling resources during high traffic, and resolving errors when integrations break. While this may offer better insight and control, it can also be a major drain on time and energy.

Scalability and Performance

Most hosted platforms provide auto-scaling or pre-configured infrastructure that adjusts to your traffic levels. This is particularly useful during sales events or unexpected traffic spikes. However, because these services cater to a wide range of users, customization is sometimes limited.

In self-hosted environments, you can configure exactly how your server scales, optimize for specific performance benchmarks, or even run your GTM container in regions closest to your users for faster response times. You also control caching, logging, and load balancing.

Privacy and Data Control

Privacy is a growing concern, especially for merchants operating in regions with strict data protection laws. With hosted platforms, your data passes through third-party infrastructure - though many hosted platforms support custom domains, making your tracking appear first-party to browsers.

Self-hosting gives you complete ownership of your data, logs, and infrastructure. This can be a critical requirement for businesses in regulated industries or for those looking to minimize third-party data exposure. You can also enforce stricter data retention policies and avoid vendor lock-in.

Customization and Flexibility

Hosted platforms often come with prebuilt integrations, templates, and workflows designed to speed up setup for common use cases (e.g., GA4, Meta CAPI, TikTok). However, this simplicity can also be limiting. You may not have full control over advanced routing logic, custom API integrations, or unique data handling workflows.

With a self-hosted solution, your GTM server is just one piece of a system you entirely control. You can build custom APIs, write your own logging pipelines, use alternative database systems, or integrate with internal dashboards and reporting tools.

Support and Community

Hosted solutions typically include customer support, documentation, and sometimes even live chat or onboarding assistance. As platforms mature, their communities grow and resources become more robust.

With self-hosted setups, support depends on your own expertise or your ability to navigate forums, GitHub issues, and Stack Overflow. While Google Tag Manager Server Container has a developer community, getting timely help can be a challenge unless you have in-house technical resources.

Which Should You Choose?

If you’re a Shopify merchant who wants a fast, low-maintenance, reliable way to start using server-side tracking - hosted platforms like Stape are the way to go. They’re built for simplicity, come with solid documentation, and let you get up and running in a matter of hours.

If you’re a developer, agency, or enterprise with unique privacy requirements, deep customization needs, or a desire for full data control - self-hosting may be the better route. Just be ready to commit time and technical effort to planning, deploying, and maintaining your setup.

Both options have merit, but it comes down to your specific goals, budget, and technical capacity.

FAQs

What is server-side tracking in Shopify?

Server-side tracking in Shopify involves collecting user data on your server and sending it directly to analytics or ad platforms. This avoids browser-related issues like ad blockers or cookie restrictions.

Is server-side tracking better than client-side tracking?

Yes, in many respects. Server-side tracking is more reliable, bypasses blockers, and offers better data control. However, for best results, it should complement client-side tracking rather than replace it entirely.

Do I need Google Tag Manager to use server-side tracking?

No, but it’s highly recommended. GTM’s server container provides a centralized, scalable way to manage server-side tracking across platforms.

Can I use server-side tracking with Meta, GA4, and TikTok?

Absolutely. All three platforms support server-side tracking via APIs. You’ll need proper configuration and credentials to connect them through your server.

Does Shopify natively support server-side tracking?

Not directly. Shopify doesn’t offer built-in server-side tracking, but third-party tools and apps can help you integrate it seamlessly.

Are you ready to Grow your Business?

Get started