Server-Side Tracking for Shopify

Server-Side Tracking for GA4, Google Ads, and GTM

Guide 8 min read

Contributors

Understanding GA4, Google Ads, and GTM in a Server-Side Context

When merchants hear “server-side tracking,” they often assume it applies the same way across all platforms — that you can send every event from your server, bypass browser issues, and get better results instantly. 

And while that’s mostly true for platforms like Meta or TikTok, Google’s tracking ecosystem doesn’t work the same way.

To implement a reliable setup for GA4 and Google Ads, you need to understand how each tool operates — and how server-side fits into the picture.

Roles of GA4, Google Ads, and GTM in Tracking

Even though GA4, Google Ads, and Google Tag Manager are part of the same ecosystem, each tool has a different purpose and different technical rules.

Tool What It Does Server-Side Support
GA4 Tracks user behavior, sessions, conversions ✅ Yes — via Measurement Protocol API
Google Ads Tracks ad conversions and powers smart bidding ❌ No direct server-side API for purchases
Google Tag Manager (GTM) Manages tracking tags and triggers ✅ Yes — via Server-side GTM containers

While GA4 allows server-side event delivery, Google Ads does not support purchase tracking via server-side API. Instead, Google Ads relies on client-side conversions and Enhanced Conversions, which still depend on browser-based scripts.

Common Misunderstanding: “You Can Do Server-Side Tracking for Google Ads”

Unlike GA4 or Meta, Google Ads does not provide a direct server-side API for purchase tracking. While it’s possible to use Enhanced Conversions or fire tags through server-side GTM, the core tracking signal still depends on a browser-based conversion trigger.

A full breakdown of this limitation — and how to work around it — is covered in the next sections. conversion-api-availability-google-ads-Ip348fao.jpg

When GA4 Should Be Used Server-Side

GA4 is unique in that it allows events to be sent directly to its servers via the Measurement Protocol — making it the most flexible and reliable option for server-side tracking in the Google ecosystem.

But even here, there are rules:

  • GA4 still requires client-side tracking for user sessions and consent.

  • You can’t send the same event from both layers without proper deduplication.

  • Only purchase events should be sent server-side — because that’s the only event with full backend data in Shopify.

Analyzify uses this recommended hybrid method: it sends GA4 purchase events from the server, but keeps events like page_view and add_to_cart on the client side.

How GTM Connects Client and Server Tracking

Google Tag Manager (GTM) helps you orchestrate both sides of your tracking stack — but the two container types behave very differently:

  • Client-Side GTM (Web) runs in the browser and captures real-time behavior.

  • Server-Side GTM (sGTM) sits on a cloud server and can process incoming events (like from Shopify webhooks or browser tags) and forward them to platforms.

how-gtm-connects-client-and-server-tracking-8pDmjjdu.jpg

However, simply moving tags from client to server doesn’t mean you’re getting true server-side tracking. Without enriched data and platform-specific consent logic, it’s just a technical shift — not a tracking upgrade.

Analyzify handles these complexities for you by:

  • Collecting consent and client ID on the browser

  • Enriching events using Shopify order data

  • Sending deduplicated GA4 purchases via server-side only

Key Takeaways for Shopify Merchants

✅ GA4 allows true server-side tracking — but only for purchase events

❌ Google Ads doesn’t support purchase tracking server-side — Enhanced Conversions is still browser-dependent

✅ GTM server-side can help with tag delivery — but needs enriched data to be useful

✅ A hybrid tracking setup is the only way to get full coverage and accuracy in the Google ecosystem

GA4 Hybrid Setup — What to Track Server-Side (and What You Can’t)

Google Analytics 4 (GA4) is often promoted as a flexible, privacy-conscious analytics platform — and when paired with server-side tracking, it can significantly improve data reliability.

But let’s be clear upfront: you cannot track everything via the server. GA4 requires a hybrid setup, where client-side and server-side layers work together — each covering the part of the tracking journey it’s uniquely equipped to handle.

Why GA4 Requires Both Client-Side and Server-Side Tracking

Some merchants hope server-side tracking will replace browser scripts entirely. But that’s not how GA4 is designed.

GA4 still depends on the browser for several critical components — including user sessions (client_id), consent status (captured via tools like Google Consent Mode), and attribution signals such as UTM parameters and referral sources.

You still need the browser layer to capture attribution, sessions, and consent — GA4 can’t track that server-side.

should-ga4-tracking-rely-solely-on-server-side-or-combine-with-client-side-UDisvnaE.jpg

Without it, you’ll lose visibility into traffic sources, campaign performance, and how users interacted before buying. 

In short: you’ll know a purchase happened — but not how, where, or why.

Which GA4 Events Should Be Tracked Server-Side?

Only a few events make sense to send from the server. The best example: purchase events.

Here’s why:

  • Shopify’s backend contains full, verified order data.

  • Webhooks are triggered reliably — even when users abandon the thank_you page.

  • You avoid browser-related failures from ad blockers, iOS privacy settings, or checkout sandboxing.

That’s why Analyzify sends only the purchase event via GA4’s Measurement Protocol — giving you up to 98% accuracy in most Shopify setups.

Which Events Should Stay Client-Side?

GA4 expects behavioral events like page_view, view_item, add_to_cart, and begin_checkout to originate in the browser — where user activity actually happens. These interactions rely on frontend engagement, making them unsuitable for server-side tracking.

Sending these from the server would require simulating session behavior — which is neither accurate nor reliable.

✅ Best Practice: Keep all user interaction events in client-side GA4

✅ Send only purchase via server-side with enriched data and deduplication

Why You Can’t Send the Same Event Twice

A common mistake is firing the same event both client-side and server-side without coordination. This causes:

  • Double counting in GA4 reports

  • Distorted revenue and conversion metrics

  • Incorrect attribution paths

avoiding-event-duplication-in-ga4-e3GRYTUn.jpg

GA4 does not automatically deduplicate server-side events like Meta or TikTok. Instead, you must choose one source per event — and align your setup accordingly.

Analyzify handles this by:

  • Sending behavior events via browser GTM or Shopify Pixels

  • Sending the purchase event only from the server

  • Ensuring event_id is used consistently for platforms that support deduplication

How Consent Mode Affects GA4 Tracking

Google Consent Mode introduces another key requirement: client-side consent capture.

Here’s how it works:

  • When a user lands on your site, the client-side script checks their consent status.

  • If they accept tracking, data is sent normally.

  • If they decline, only limited (non-personal) data is allowed — and only for Google platforms like GA4.

Server-side GA4 tracking can still send anonymized purchase events in this case — but only if client_id and consent state were collected earlier in the browser.

Final Tips for Shopify Stores

To implement GA4 server-side tracking properly:

✅ Keep client-side GA4 active for attribution, behavior, and consent
✅ Send only the purchase event server-side using Shopify’s order data
✅ Don’t duplicate events across layers — pick one source per event
✅ Ensure consent is collected and passed using Shopify’s Privacy API and Google Consent Mode

When done right, this hybrid setup gives you the best of both worlds — reliable purchase tracking and rich behavioral insights — all while staying privacy-compliant and Shopify-aware.

Google Ads Tracking — What You Can and Can’t Do Server-Side

Shopify merchants often assume that if they’ve implemented server-side tracking for GA4 or Meta, the same approach will improve their Google Ads performance.

Unfortunately, this belief is not only misleading — it can lead to incorrect setups, wasted developer time, and unreliable results.

The Misconception: “Google Ads Has a Server-Side API for Purchases”

There’s a common narrative that Google Ads supports purchase tracking through server-side methods — similar to Meta’s Conversions API or TikTok’s Events API.

❌ But Google Ads has no dedicated API for receiving e-commerce purchase events directly from your server.

The closest alternative is Enhanced Conversions, which enriches existing browser-based conversions using first-party data (like hashed email or phone number). But it still depends on a client-side conversion trigger. You can’t start a new conversion from the server alone.

enhanced-conversions-process-HNe0h8kX.jpg

What Actually Exists: Enhanced Conversions — Not a Replacement

Enhanced Conversions is currently the most effective way to improve Google Ads match quality. Here’s how it works:

  • A standard browser-based conversion tag fires when the user completes a purchase.

  • At the same time, additional customer data (email, phone, etc.) is sent in hashed form to Google.

  • Google uses this to improve conversion attribution, especially when third-party cookies fail — but this process still depends on proper user consent, typically managed via Google Consent Mode.

This mechanism can be deployed through:

  • A standard client-side GTM tag,

  • Server-side GTM (sGTM),

  • Or direct script implementation.

But regardless of where it runs, it still begins in the browser.

✅ Bottom line: Enhanced Conversions improves what your browser-based tags already track — it can’t function alone.

Can You “Send Google Ads Conversions via Server-Side GTM”?

Technically, yes — but only in a limited sense. You can fire Google Ads tags inside a server-side GTM container. 

limitations-of-server-side-gtm-for-google-ads-conversions-vzwfOZWZ.jpg

However:

  • This doesn’t connect to a true conversion API.

  • It doesn’t bypass the need for a browser-triggered event.

  • You won’t gain any additional tracking capability — you’re just moving the tag’s firing location.

This setup is sometimes useful for latency or cookie control purposes, but it does not improve accuracy the way it does for GA4 or Meta.

What About the Google Ads Leads API?

There is one official Google Ads API: the Leads API, designed for lead generation use cases — like form submissions.

It was not built for ecommerce purchases, and using it for that purpose results in:

  • Incomplete purchase data,

  • Misclassified events in Google Ads reports,

  • And limited optimization benefits.

Analyzify does offer support for this API where needed — but we strongly caution against using it to simulate purchase conversions.

Recommended Approach for Shopify Merchants

To get the most out of Google Ads on Shopify:

✅ Use standard client-side conversion tracking

✅ Enable Enhanced Conversions with complete customer data

✅ Collect consent and hashed identifiers responsibly

✅ Keep server-side GTM optional — but not as a replacement for actual conversions

✅ Avoid trying to mimic Meta’s CAPI behavior — it simply doesn’t apply

Some merchants also choose to import GA4 conversions into Google Ads. This creates an indirect server-side path — but it comes with trade-offs:

  • These imported conversions often underreport results compared to native tracking.

  • They also do not benefit from Enhanced Conversions.

Implementing Server-Side GTM for Shopify

Google Tag Manager’s server-side container (sGTM) is often misunderstood. While it sounds like a universal upgrade, setting it up for Shopify tracking requires a very specific structure — and a clear understanding of what sGTM actually does (and doesn’t do).

What Server-Side GTM Actually Does

A server-side GTM container sits between your data sources (e.g., browser, Shopify webhooks) and your destination platforms (e.g., GA4, Google Ads, Meta).

server-side-gtm-process-EiyxHVSJ.jpg

It allows you to:

  • Receive incoming event data (from browser tags, Shopify, etc.)

  • Enrich or clean the data (e.g., add client_id, remove PII)

  • Forward it to platforms like GA4 or Meta with greater control

But it’s important to clarify:

❌ Server-side GTM works alongside your browser setup — it doesn’t replace it.

❌ It does not automatically provide tracking improvements

✅ It’s a middleware layer that lets you manage data flow with more precision

Why sGTM Requires a Cloud Hosting Setup

Unlike browser GTM, the server-side container must be self-hosted or run on a cloud platform — typically Google Cloud Platform (GCP).

This adds a few layers of complexity:

  • You need to set up and maintain a GCP environment

  • Server costs and permissions need to be managed

  • Shopify-specific tracking logic must be implemented manually

Since most merchants prefer to avoid managing Google Cloud infrastructure directly, Analyzify provides a fully hosted server-side GTM setup with Shopify-specific logic built in.

Shopify-Specific Requirements for Server-Side GTM

Running sGTM for Shopify tracking involves more than just deploying a server — it requires platform-specific handling to avoid false data or missed conversions. Here are the key considerations:

shopify-specific-requirements-for-server-side-gtm-5V3adx1K.jpg

1. Wait for order_status = paid

Shopify fires multiple events during the checkout process, including order_created, which doesn’t necessarily mean the transaction is complete. sGTM must be configured to ignore early-stage events and only send data when the payment is confirmed and the order status is marked as paid.

2. Handle Draft Orders and App-Based Flows

Some sales channels — like subscriptions, invoices, or third-party apps — use Draft Orders or alternative checkout flows that don’t trigger standard events. A Shopify-specific setup needs to detect these cases using webhook logic to ensure accurate and complete tracking.

3. Respect Consent Captured in the Browser

Even when tracking from the server, user consent must still be collected client-side. Tools like Shopify’s Customer Privacy API and Google Consent Mode ensure that tags like Meta or Google Ads aren’t fired without proper permission. Your sGTM logic must evaluate and respect this consent status before triggering any marketing events.

4. Use First-Party Identifiers Correctly

Identifiers such as client_id (for GA4) and fbp or ttclid (for Meta and TikTok) originate in the browser. sGTM should preserve and attach these values to outgoing server events to ensure proper event attribution. Without them, platforms may ignore the event or fail to match it to the correct session.

When Should You Use Server-Side GTM?

Use sGTM when:

  • You want to clean and enrich data before sending it to platforms.

  • You need more control over cookie behavior or tag firing.

  • You’re managing complex data privacy requirements (e.g., consent gating, GDPR logic).

Avoid sGTM if:

  • You expect it to magically improve tracking accuracy on its own.

  • You’re not ready to manage cloud infrastructure or custom event flows.

  • You don’t have proper consent collection on the client side.

You are currently viewing the "Server-Side Tracking for GA4, Google Ads, and GTM"

Guide 2 First-Party Data for Shopify Merchants arrow-right Previous
Sign up for our newsletter
Be the first to know about releases and industry news and insights.
We care about your data in our privacy policy.
Take the first step towards reliable tracking Join 3,000+ merchants who trust their tracking with Analyzify.