Pay Per Click
18 minute read

How to Set Up Server-Side Tracking for Shopify: A Complete Step-by-Step Guide

Written by

Grant Cooper

Founder at Cometly

Follow On YouTube

Published on
March 17, 2026

If you're running paid ads for your Shopify store, you've probably noticed something frustrating: the numbers in your ad platforms don't match your actual sales. You check Meta Ads Manager and see 47 purchases. Then you check Shopify and count 68 orders. The gap keeps growing, and you're left wondering which campaigns are actually profitable.

iOS privacy updates, browser tracking prevention, and ad blockers have created massive blind spots in your marketing data. Every time a customer opts out of tracking or uses Safari with Intelligent Tracking Prevention enabled, your pixel loses sight of that conversion. The result? Your ad platforms optimize based on incomplete data, and you make budget decisions without knowing the full picture.

The solution? Server-side tracking.

Unlike traditional browser-based tracking that relies on cookies and JavaScript, server-side tracking sends conversion data directly from your server to ad platforms—bypassing the restrictions that cause data loss. When someone completes a purchase on your Shopify store, your server immediately sends that conversion event to Meta, Google, TikTok, and any other platform you're running ads on. No browser required. No tracking restrictions can block it.

This guide walks you through setting up server-side tracking for your Shopify store, from understanding what you need to verifying your implementation is working correctly. By the end, you'll have accurate conversion data flowing to your ad platforms, enabling better optimization and clearer attribution. Let's get started.

Step 1: Audit Your Current Tracking Setup and Identify Data Gaps

Before you implement server-side tracking, you need to understand exactly how much data you're currently losing. This baseline measurement will help you quantify the improvement once server-side tracking is live.

Start by comparing reported conversions in your ad platforms against actual Shopify orders. Pick a recent 7-day period and pull the purchase conversion count from Meta Ads Manager, Google Ads, and any other platforms you're running. Then go into Shopify Analytics and count the total orders for that same period.

The math is simple but often shocking. If Meta reports 120 purchases but Shopify shows 180 orders, you have a 33% tracking gap. Many Shopify stores discover they're missing 20-40% of their conversions in ad platform reporting. Some see gaps even larger, especially if they have a mobile-heavy customer base affected by iOS tracking restrictions.

Next, document which events you need to track beyond just purchases. Most Shopify stores should be tracking at least four key events: page views, add to cart, initiate checkout, and purchase. If you're running retargeting campaigns, you might also want to track product views or collection views. Write down which events matter for your specific ad strategies.

Now identify your primary ad platforms that need server-side event feeds. If you're running Meta and Google Ads, those are your priorities. Running TikTok or Pinterest? Add those to the list. The goal is to send server-side events to every platform where you're actively optimizing campaigns.

Take screenshots of your current conversion reporting in each platform. These will serve as your before-and-after comparison once server-side tracking is implemented. Pay special attention to the attribution window settings—make sure you're comparing apples to apples when you measure improvement later. Understanding why server-side tracking is more accurate will help you set proper expectations for your results.

This audit gives you the data foundation you need. You know your tracking gap percentage, you've documented which events matter, and you've identified which platforms need server connections. Now you can choose the right implementation method.

Step 2: Choose Your Server-Side Tracking Method

You have three main approaches to implementing server-side tracking for Shopify. Each has different technical requirements, costs, and capabilities. The right choice depends on your technical resources, number of ad platforms, and whether you need unified attribution across channels.

Option A: Native Platform Solutions

Meta offers the Conversions API, and Google provides Enhanced Conversions. These are direct server-to-platform connections you set up individually for each ad network. The advantage? No third-party costs and complete control over your data flow. The challenge? You need technical expertise to implement and maintain each connection separately.

Setting up Meta's Conversions API requires generating access tokens, configuring event parameters with proper SHA-256 hashing, and implementing event deduplication logic. Google's Enhanced Conversions needs server-side tagging through Google Tag Manager or a direct API integration. If you're running ads on TikTok, Snapchat, or Pinterest, you'll need to set up separate server connections for each platform using their respective APIs. Before deciding, review a comprehensive comparison of server-side tracking tools to understand your options.

This approach works well if you have a developer on your team, you're only using one or two ad platforms, and you don't need cross-platform attribution reporting. The ongoing maintenance burden is real—when platforms update their APIs or requirements, you'll need to update your implementations.

Option B: Third-Party Attribution Platforms

Platforms like Cometly handle server connections automatically across multiple ad networks. You connect your Shopify store once, and the platform manages server-side event delivery to Meta, Google, TikTok, and other channels. These solutions also provide unified attribution reporting, showing you the complete customer journey across all touchpoints.

The key advantage is speed and simplicity. Instead of building and maintaining separate integrations for each ad platform, you get a single connection that handles everything. Cometly captures every touchpoint from ad clicks to CRM events, enriches the data with customer journey context, and sends properly formatted server events to each ad platform automatically.

This option makes sense if you're running ads on multiple platforms, you want unified attribution reporting, or you don't have dedicated development resources. The trade-off is a monthly subscription cost, but many merchants find this worthwhile compared to developer time and the risk of implementation errors.

Option C: Custom Webhook Implementations

Shopify allows you to set up webhooks that fire when specific events occur in your store. You can use Shopify Flow, third-party apps, or custom code to capture these webhooks and forward conversion data to ad platforms. This gives you flexibility to build exactly what you need.

The challenge is that you're essentially building your own attribution system. You need to handle webhook reliability, event formatting, customer data hashing, deduplication logic, and error handling. For most Shopify merchants, this approach requires more effort than it's worth unless you have very specific requirements that native solutions or third-party platforms can't meet.

Evaluate your choice based on three factors: Do you have technical resources to build and maintain integrations? How many ad platforms do you need to connect? Do you need unified attribution reporting across channels? For most Shopify stores running multiple ad platforms, a third-party attribution solution offers the best balance of accuracy, speed, and ongoing maintenance.

Step 3: Configure Shopify to Send Server-Side Events

Once you've chosen your implementation method, you need to configure Shopify to make the right data available for server-side tracking. This step ensures your store captures and sends the customer information needed for accurate event matching in ad platforms.

Start by enabling Shopify's Customer Events API in your store settings. Navigate to Settings > Customer Events in your Shopify admin. This API provides webhook access to checkout and order events that you'll use to trigger server-side conversions. If you're using a third-party platform like Cometly, this connection typically happens automatically when you install their app.

Next, set up proper customer identification. Ad platforms need specific data points to match your server events to ad interactions. The most critical identifier is email address. Your Shopify checkout should require email for all purchases—this is typically enabled by default, but verify it in your checkout settings. For a complete walkthrough, check out this ad tracking setup guide for Shopify stores.

Phone numbers significantly improve match rates, especially for Meta. If you're not currently collecting phone numbers at checkout, consider adding this field. It's not required for checkout completion, but many customers will provide it if asked. Meta's Event Match Quality scores improve substantially when you include both email and phone in your server events.

Customer data must be properly formatted and hashed before sending to ad platforms. Email addresses should be converted to lowercase and trimmed of whitespace before hashing with SHA-256. Phone numbers should be formatted in E.164 format (country code plus number, no spaces or special characters). If you're using a third-party platform, this formatting happens automatically. If you're building custom integrations, you need to implement this logic yourself.

Configure order webhooks to fire on checkout completion. Shopify provides several webhook topics—the most important for conversion tracking is orders/create, which fires when a new order is created. This webhook contains all the order details you need: customer information, order total, products purchased, and any custom attributes you've added.

Ensure your checkout captures the data points needed for matching. Beyond email and phone, you want to capture first name, last name, city, state, zip code, and country. These additional parameters improve match quality when email or phone aren't available or when multiple customers share the same contact information.

If you're using Shopify's native checkout, these fields are typically captured automatically. If you've customized your checkout with Shopify Scripts or a third-party checkout app, verify that all necessary customer data is being collected and passed through to your order webhooks.

Test your webhook configuration by placing a test order. Use Shopify's webhook testing tools or check your server logs to confirm the webhook fires correctly and contains all expected customer data. This validation step prevents frustrating debugging later when you're trying to figure out why events aren't matching in ad platforms.

Step 4: Connect Your Ad Platforms to Receive Server Events

With Shopify configured to send event data, you need to set up each ad platform to receive and process those server-side events. The specific steps vary by platform, but the core concepts remain consistent: authentication, event mapping, and deduplication configuration.

For Meta (Facebook and Instagram Ads):

Navigate to Events Manager and select your pixel. Go to Settings and find the Conversions API section. You'll need to generate an access token that authorizes your server to send events to Meta. Click "Generate Access Token" and save this securely—you'll use it to authenticate your server requests.

Configure the Conversions API by mapping your Shopify events to Meta's standard event names. A Shopify order creation maps to Meta's "Purchase" event. Add to cart becomes "AddToCart". Checkout initiation becomes "InitiateCheckout". Use Meta's standard event names exactly as documented to ensure proper optimization. Understanding the difference between server-side tracking vs pixel tracking helps you configure both correctly.

Set up event deduplication by assigning a unique event ID to each conversion. This is critical—without proper deduplication, Meta will count both your pixel event and your server event as separate conversions, inflating your numbers. Use the Shopify order ID as your event ID for purchase events, and generate consistent IDs for other events based on session data and timestamp.

Configure your server events to include the event_id parameter matching your pixel implementation. When Meta receives both a pixel event and a server event with the same event_id within a 48-hour window, it automatically deduplicates them and counts only one conversion.

For Google Ads:

Enable Enhanced Conversions in your Google Ads account. Go to Tools > Conversions and select the conversion action you want to enhance. Click "Edit settings" and enable Enhanced Conversions. You'll need to accept Google's customer data terms. For detailed instructions, see our guide on how to set up Google Ads conversion tracking for Shopify.

Configure server-side tagging if you're using Google Tag Manager Server-Side, or set up a direct API connection if you're building a custom implementation. Google's Enhanced Conversions work by sending hashed customer data (email, phone, address) alongside conversion events, which Google uses to improve attribution accuracy.

Map your Shopify events to Google's conversion actions. Your purchase event should trigger the conversion action you've set up for transactions. Include order value, currency, and transaction ID in each conversion event. Google uses this data for value-based bidding and ROAS optimization.

Implement deduplication using the transaction ID. Send the same Shopify order ID in both your website tag conversion and your server-side conversion. Google automatically deduplicates conversions with matching transaction IDs.

For TikTok Ads:

Access TikTok Events Manager and navigate to your pixel. Go to Settings and find the Events API section. Generate your access token and save it for authentication. TikTok's Events API follows a similar pattern to Meta's Conversions API.

Map Shopify events to TikTok's event names. Purchase events use "CompletePayment". Add to cart uses "AddToCart". View content uses "ViewContent". TikTok's event naming is similar to Meta's but not identical, so verify you're using the correct names from TikTok's documentation.

Configure event deduplication using the event_id parameter. Like Meta, TikTok deduplicates events with matching event IDs received within a specific time window. Use your Shopify order ID or generate consistent IDs based on session and timestamp data.

The critical principle across all platforms: implement event deduplication to avoid double-counting conversions. Both your browser pixel and your server should send events, but platforms should count them only once. Proper event ID implementation ensures this happens automatically.

Step 5: Implement Event Deduplication and Data Enrichment

Event deduplication is the most critical technical aspect of server-side tracking. Without it, you'll count conversions twice—once from your browser pixel and once from your server. This inflates your conversion numbers and makes your ad performance look better than reality. Let's ensure your implementation handles this correctly.

Use consistent event IDs across client-side and server-side events. For purchase events, the Shopify order ID is your best choice—it's unique, it's generated at the moment of purchase, and it's available to both your browser pixel and your server webhook. For non-purchase events like add to cart or initiate checkout, you need to generate IDs based on session data and timestamp.

A common pattern is to combine the customer's session ID with the event type and a timestamp rounded to the nearest second. For example: session_abc123_addtocart_1678901234. This creates a unique identifier that both your client-side and server-side implementations can generate independently using the same logic. Learn more about the benefits of server-side tracking to understand why this extra effort pays off.

Add UTM parameters and click IDs to server events for better attribution. When someone clicks your ad and lands on your Shopify store, capture the UTM parameters and platform-specific click IDs (fbclid for Meta, gclid for Google). Store these in the customer's session or in a cookie. When they complete a purchase, include these parameters in your server-side event.

This click ID data helps ad platforms attribute the conversion to the correct ad, campaign, and ad set. Without it, server events provide conversion data but may not attribute properly to specific campaigns. Meta's fbp and fbc parameters are particularly important—these browser cookies help Meta match server events to ad interactions.

Enrich events with customer lifetime value, order details, and product categories. Your server has access to much richer data than your browser pixel. Include product SKUs, product categories, customer segments, and whether this is a first purchase or repeat purchase. This enriched data enables more sophisticated optimization in ad platforms.

For example, Meta can optimize for high-value customers if you include customer lifetime value in your server events. Google can optimize for specific product categories if you include that data. The more relevant data you send, the better platforms can optimize delivery to the right audiences.

Configure event priority so server events take precedence when duplicates occur. Both Meta and Google allow you to set which event source is considered more reliable. Server events should be prioritized because they're not affected by browser restrictions or ad blockers. In Meta's Events Manager, you can configure this in the Conversions API settings under "Event Priority".

Test your deduplication logic by placing a test order and checking Events Manager. You should see the event appear once, not twice. Meta's Events Manager shows you the source of each event—pixel, Conversions API, or both. If deduplication is working correctly, events received from both sources will show as a single conversion with "Deduplication" indicated in the source column.

Step 6: Test and Validate Your Server-Side Tracking

Implementation is only half the work. Thorough testing ensures your server-side tracking actually works before you rely on it for optimization decisions. This validation process catches configuration errors, data formatting issues, and deduplication problems before they affect your ad performance.

Use Meta's Test Events tool to verify events are received correctly. In Meta Events Manager, go to Test Events and enter your test event code. Place a test order on your Shopify store, and you should see the purchase event appear in the Test Events interface within seconds. Check that all parameters are populated correctly: event name, event time, customer data, purchase value, and currency.

Google's Tag Assistant serves a similar purpose for Google Ads. Install the Tag Assistant browser extension, enable it, and place a test order. You should see your Enhanced Conversion fire with all expected parameters. Verify that customer data is being hashed correctly—Tag Assistant will show you if there are formatting errors. If you encounter issues, review common server-side tracking setup challenges and their solutions.

Place multiple test orders and confirm they appear in platform dashboards within 24 hours. While test tools show real-time event delivery, the actual reporting in Ads Manager can take several hours to update. Place three to five test orders, wait 24 hours, and verify that all of them appear in your conversion reporting.

Check Event Match Quality scores in Meta. This metric measures how well your server events can be attributed to ad interactions based on the customer data you're sending. Navigate to Events Manager, select your pixel, and view the Event Match Quality score. Aim for 6.0 or higher. Scores below 5.0 indicate you're missing critical customer data parameters.

If your Event Match Quality is low, the most common fixes are adding phone numbers to your server events, including the fbp and fbc browser cookie values, and ensuring email addresses are properly formatted and hashed. Each additional parameter you include improves match quality and attribution accuracy.

Compare 7-day conversion totals between Shopify and ad platforms to measure improvement. Pull the same report you created in Step 1—Shopify orders versus platform-reported conversions. You should see the gap narrow significantly. A tracking gap that was 30-40% before server-side tracking should drop to 5-10% or less. For ongoing monitoring, consider using conversion tracking software for Shopify that provides real-time validation.

Some gap will always exist due to attribution windows, canceled orders, and test purchases that appear in Shopify but not in ad reporting. But the gap should be dramatically smaller than before. If you're still seeing a large discrepancy, check your event deduplication logic and verify that all order webhooks are firing correctly.

Monitor error rates in your server-side implementation. Most platforms provide error reporting that shows you when events fail to process. Common errors include authentication failures (expired access tokens), data formatting issues (improperly hashed customer data), and missing required parameters. Set up alerts so you're notified immediately if error rates spike.

Create a recurring calendar reminder to check your implementation monthly. Server-side tracking isn't set-it-and-forget-it. Platforms update their APIs, Shopify releases new features, and your store's checkout flow may change. Regular validation ensures your tracking stays accurate as your business evolves.

Putting It All Together

With server-side tracking properly configured, your Shopify store now sends accurate conversion data directly to your ad platforms—regardless of browser restrictions or ad blockers. Your tracking gap has narrowed from 30-40% down to single digits. Your ad platforms receive enriched conversion data with customer journey context. And your optimization algorithms have the accurate signal they need to improve performance.

Here's your quick validation checklist: tracking audit completed with baseline gap measured, server-side method selected and implemented, Shopify webhooks configured to fire on key events, ad platforms connected with proper authentication and event mapping, event deduplication active and tested, and test conversions verified in platform dashboards.

Monitor your Event Match Quality scores weekly. This is your early warning system for tracking degradation. If scores drop, investigate immediately—it usually means customer data parameters are missing or improperly formatted. A quick fix now prevents weeks of suboptimal ad delivery.

Compare platform-reported conversions against Shopify orders monthly. This ongoing validation ensures your tracking stays accurate as your business scales. If the gap starts widening again, you'll catch it early and can troubleshoot before it impacts your optimization.

As your data accuracy improves, you'll see better ad optimization. Platforms can identify which audiences, creatives, and placements actually drive purchases. You'll see more reliable ROAS calculations, making budget allocation decisions clearer. And you'll gain insight into which campaigns actually drive revenue, not just which ones get credit in a cookie-restricted environment.

The investment in server-side tracking pays dividends in every aspect of your paid advertising. Your retargeting audiences become more accurate. Your lookalike audiences are built from complete conversion data. Your automated bidding strategies optimize toward real purchases, not partial data. And you can finally trust that the numbers in your ad platforms reflect reality.

Ready to elevate your marketing game with precision and confidence? Discover how Cometly's AI-driven recommendations can transform your ad strategy—Get your free demo today and start capturing every touchpoint to maximize your conversions.