Tracking

How to set up first-party tracking on Shopify

First-party tracking on Shopify step by step: what it means, three ways to set it up, which data to keep in the cart and order, and how to check it works.

·9 min read·By the ROASaurus team

Key takeaways
  • First-party tracking means your store collects the click ids, UTMs and visitor id on its own domain and sends conversions from its own order data, instead of relying on each platform's third-party script.
  • On Shopify there are three routes: Shopify's own channel apps, a server-side Google Tag Manager container, or an app that sends events from the order data.
  • Store the source of the visit in the cart, so it travels with the order even when the purchase happens hours later or the pixel was blocked.
  • Purchases should always be sent server-side; storefront events such as add to cart add context for audiences and bidding.
  • First-party is not consent-free: the visitor's choice still decides which identifiers you may store and send.

To set up first-party tracking on Shopify, collect the click ids, UTM tags and a visitor id on your own store domain when a visitor lands, carry them into the cart so they arrive with the order, and send each paid order from Shopify's order data to the ad platforms' server APIs. You can do this with Shopify's own channel apps, with a server-side Google Tag Manager container, or with a tracking app that sends events from the order itself.

This guide explains what first-party tracking means and what it does not, why Shopify stores lose data without it, the three setup routes, which data and events to capture, and how to check that it works.

What first-party tracking means, and what it does not

First-party data is data collected directly between your store and your visitors, under your own domain: the UTM tags and click id a visitor arrives with, their cart, their order and the details they give you at checkout. First-party tracking means your store is the source of truth. It collects that data itself and sends the conversions to Meta, Google, TikTok and the other platforms, instead of each platform's script collecting it in the browser on its own terms.

It means
  • Click ids and UTMs saved on your own domain
  • The visit linked to the order through the cart
  • Purchases sent from your order data, server to server
  • A log of what was sent, per order and platform
It does not mean
  • No pixels at all: the pixel still adds context
  • No consent: the visitor's choice still applies
  • Matching numbers in every tool: each platform still attributes its own way
  • Data from people who blocked everything before landing
First-party tracking improves the data that goes in. It does not change how each platform reads it.

Why Shopify stores lose data without it

A typical browser-only flow: a shopper clicks an ad, lands on your store, checks out, and a pixel fires on the thank-you page. That pixel needs its script to load, its cookie to survive, the visitor's consent and a page that finishes loading. If any link breaks, the order exists in Shopify but never reaches the ad platform.

  • Blocked scripts. Ad blockers and privacy browsers stop the platform's script. See what ad blockers do to your tracking.
  • Short cookie lives. Safari limits cookies set by scripts to 7 days, or 24 hours after a visit from a link with a click id, so a shopper who returns later looks new.
  • Lost campaign data. Shopify records the visits to your store and the landing page, but a UTM tag or click id that no tool saved on landing is hard to recover hours later.
  • Checkout limits. Shopify's checkout runs custom pixels in a sandbox, so code from your theme does not run there.
  • Payment redirects. A wallet or payment page on another domain can break the chain between the visit and the confirmation page.

The result is the familiar gap between Shopify revenue and Ads Manager revenue. Why attribution numbers don't match across platforms explains the rest of that gap.

What changes when you switch

With first-party tracking, the conversion event is created from the order in Shopify, not from a page in the browser. It goes server to server to each platform, with the click id and the hashed email and phone from the order. Three things change: more purchases reach each platform, the platforms have more data to match them to people, and your reports stop swinging with every browser update.

LandingClick id and UTMs saved on your own domain.
CartA visitor id written to the cart attributes.
OrderShopify creates the order with those attributes.
ServerThe purchase goes to each platform's API.
The source of the visit travels with the order, so the purchase can be credited even when the pixel never fired.

What you need before you start

  • Admin access to your Shopify store, with permission to install apps.
  • For each ad platform: the pixel or dataset id, and access for server events (an access token, or a login the tracking app can use).
  • A consent banner: Shopify's own, or a consent tool such as Cookiebot, OneTrust or Usercentrics.
  • A list of everything that sends a pixel today: sales channel apps, tag manager containers, theme code, older tracking apps. You will need it to avoid sending purchases twice.

The three ways to set up first-party tracking on Shopify

RouteHow it worksStrong pointLimit
1. Shopify's channel appsThe Facebook & Instagram channel at the Enhanced or Maximum data sharing level sends Conversions API events; Google and TikTok apps offer their own optionsNo development, quick to turn onOne platform per app, few settings, and little insight into what was sent
2. Server-side Google Tag ManagerBrowser events go to your own tagging server, which forwards them to the platformsFull control over every tag and fieldHosting and upkeep; purchases still start as browser events, so a blocked browser sends nothing
3. An app that sends from the order dataPurchases are created from Shopify's order webhooks and sent server-side, with first-party click idsEvery paid order is sent, also when the browser failedAnother app to choose and pay for
Route 3 is the only one where the purchase does not depend on the browser at all. Routes can be combined, but each pixel needs exactly one sender.

Route 1 is a reasonable start for a store with one ad platform. Route 2 suits teams with a developer who maintain their own tags; the Meta Conversions API with GTM shows that route. Route 3 is what most stores with several ad platforms end up with. Server-side tracking on Shopify compares them in more detail.

Which Shopify data to store and use

Shopify gives you three places to keep first-party data, each for a different job:

LayerWhat goes thereWhy it matters
Cart attributesA visitor id, the click ids (fbc, fbp, gclid, ttclid) and the marketSaved as soon as the shopper adds to cart, so they survive a later purchase or a blocked thank-you page
OrderThe cart attributes, the landing page, the email, phone and addressThe basis of every server event: who bought, for how much, and from which visit
CustomerOrder history, first-order source, tagsRepeat purchases and lifetime value per acquisition source
Cart attributes carry the link from the visit to the order. Hidden attributes, with a name starting with an underscore, are not shown to the shopper at checkout.

Which events to track first-party

At minimum, the purchase must always go out server-side from the order, because it drives reported results and bidding. For many stores, add to cart and checkout started are worth sending too, because ad platforms optimize toward shoppers who start a purchase and your retargeting audiences are built from them. Page views and product views add context for audiences. The rule of thumb: the more an event matters for revenue or bidding, the less it should depend on a script in the browser.

Event enrichment: why the details on each event matter

A server event without context is hard for a platform to use. Enrichment means adding to each event what the platform needs to credit and match it:

  • the click id from the landing page, which ties the purchase to the exact ad click;
  • the UTM tags, for your own reports;
  • the email and phone from the order, normalized and hashed with SHA-256, plus the IP address and user agent, which let the platform match purchases without a click id.

Better enrichment raises Meta's Event Match Quality and the share of purchases each platform can attribute. Meta Event Match Quality shows which fields count most. The glossary has the short definitions of first-party data and server-side tracking.

Is first-party tracking GDPR-compliant?

It can be, if consent is handled on both sides. Server-side tracking moves where a request comes from, not what you are allowed to do: storing a click id or a visitor id in the browser, and sending identifiers for advertising, still depend on the visitor's choice. In practice that means reading Shopify's customer privacy settings or your consent tool, sending identifiers only when the visitor allowed them, and hashing personal data before it leaves your server. GDPR-compliant tracking covers the details.

Common misconceptions

  • "First-party means I can skip consent." It does not; privacy law looks at what you do with the data, not at whose domain it runs on.
  • "It will make Ads Manager match Shopify." It sends more complete data, but each platform still applies its own attribution windows.
  • "It is only for large stores." Apps make route 3 available to any Shopify store without development.
  • "I can remove the pixel." Keep it, with the same event id as the server event, so the platform gets browser context and keeps one copy. See duplicate purchase events.

When first-party tracking is a must-have

If your Shopify revenue is steadily well above what the ad platforms report, if results collapse when you scale a campaign, if traffic from iPhones looks broken, or if you no longer trust any dashboard enough to move budget, more pixel tweaks will not help. GA4 shows the same symptoms as purchases under direct traffic; see GA4 tracking problems on Shopify.

Set it up with ROASaurus

  1. Install the ROASaurus Shopify app

    It adds the storefront script as a theme app embed and the checkout pixel, and reads your orders. On Shopify, setup takes about ten minutes.

  2. Add your ad platforms

    Under Connections › Tracking & destinations, add Meta, Google Ads, TikTok and the others you use, with their pixel ids and server access.

  3. Remove second senders

    Switch off the same pixels in other apps, tag manager and theme code, so each platform gets one browser copy and one server copy with the same event id.

  4. Place a test order

    Check the platform's test events view for a browser and a server Purchase with the same id, and Data quality › Deliveries for the server delivery.

  5. Compare after a few days

    Data quality › Overview shows per platform the purchases expected from your orders and the events accepted.

On Shopify, ROASaurus collects events through the app proxy on your own store domain, at /apps/roasaurus, so there is no DNS change; on other webshops it uses a CNAME subdomain. Click ids and UTM tags are captured first-party, the visitor id (the _tl cookie) and the click ids are written to hidden cart attributes, and each paid order is sent server-side 20 seconds after payment, with one event id shared with the browser pixel. If the cart link is missing, ROASaurus falls back to the thank-you page event, the hashed email, and the IP address and browser.

The ROASaurus Mac app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
The ROASaurus iPhone app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
Per platform: the Purchase events expected from your orders, the events accepted, and the share that carried an email, phone and click id. In ROASaurus: Data quality › Overview. Public demo with a fictional store and simulated data.

Consent is read from Shopify's customer privacy settings or your consent tool. When ROASaurus respects a visitor's choice to decline, no visitor id or click id is stored and no browser events go to ad platforms; the paid order is still sent server-side to Meta, TikTok, Snapchat, Pinterest, Reddit, X, Microsoft Advertising and Taboola with the customer details hashed and without a click id, Google Ads gets it flagged as consent denied without customer details, and the other platforms get nothing. See server-side tracking, or start with the free tracking audit.

Sources

  1. Shopify Help Center: Facebook data sharing
  2. Shopify Help Center: Measuring marketing performance
  3. Shopify Dev Docs: Order object (customer journey summary, custom attributes)
  4. WebKit: Tracking Prevention in WebKit
  5. Meta for Developers: Conversions API

In ROASaurus

Keep reading

AnalyticsGA4 not tracking correctly on Shopify? Check and fix itCommon GA4 tracking problems on Shopify, each with its cause, a check you can run and the fix: duplicate tags, missing purchases, consent, events and IDs.PrivacyIs server-side tracking GDPR compliant? What it looks likeServer-side tracking is a delivery route, not a legal basis. What GDPR-friendly tracking looks like for GTM, GA4, Google Ads and Meta, with a checklist.TrackingMeta Conversions API with Google Tag Manager: setupSet up the Meta Conversions API with server-side Google Tag Manager: prerequisites, steps, deduplication, testing and where the GTM route falls short.

FAQ

Questions, answered

More answers in the FAQ and the help center.

What is first-party tracking on Shopify?

Collecting the click ids, UTM tags and a visitor id on your own store domain, carrying them into the cart and order, and sending conversions from Shopify's order data to the ad platforms' server APIs.

What do I need before I start?

Admin access to your Shopify store, the pixel or dataset id and server access for each ad platform, a consent banner, and a list of every app and tag that sends a pixel today so you can avoid duplicates.

Do I still need the Meta pixel?

Yes. Keep it with the same event id as the server event. The pixel adds browser context and cookies, and Meta keeps one copy of each purchase.

Does Shopify store UTM parameters in orders?

Shopify records the visits before an order and the landing page, but a click id or UTM tag that no tool saved on landing can be lost. Saving them in cart attributes on landing keeps them with the order.

Is first-party tracking GDPR-compliant?

It can be, if the visitor's consent decides what is stored and sent on both the browser and the server side, and personal data is hashed before it leaves your server.

How do I check that it works?

Place a test order and look for one browser and one server Purchase with the same event id in the platform's test events view. Then compare the purchases each platform accepted with your web orders after a week.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.