Skip to main content

Shopify

TraceLog captures Shopify revenue and the full checkout funnel through a hybrid integration:

  • Server-side webhook for every paid order (100% capture, independent of visitor consent).
  • Web Pixel Extension for the checkout funnel (cart, checkout started, payment, etc.).
  • Optional storefront tracking script for browsing events outside checkout.

The recommended path is the OAuth install — one click, both pieces auto-registered, no copy-paste.

Coverage matrix

PathRevenue captureFunnel eventsStorefront eventsSetup timeConsent dependent?
OAuth install (recommended)✅ 100% via webhook✅ ~70–95% via Web Pixel✅ via theme snippet1 clickFunnel only
Manual webhook✅ 100% via webhook❌ none✅ via theme snippet~5 minNo
Custom Pixel (legacy)⚠️ ~70–95% only❌ none✅ via theme snippet~10 minYes

The Custom Pixel path is deprecated and will be removed from the TraceLog wizard on 2026-06-15. Existing installations keep working until you remove them from your Shopify admin. Migrate to the OAuth path for full coverage.

Prerequisites

  • A TraceLog account with a project configured for your store domain.
  • Admin (or staff with full permissions) access to your Shopify store.

Step 1: connect Shopify from TraceLog

  1. Open your project in the TraceLog dashboard.
  2. Go to Setup → Revenue wizard.
  3. In the Shopify tab, under Connect with Shopify (OAuth), enter your shop domain (e.g. my-store.myshopify.com) and click Connect Shopify.
  4. Shopify shows a permissions screen. Review the scopes and click Install app.
  5. Shopify redirects you back to TraceLog. The wizard shows the Webhook active badge once registration completes.

When the OAuth flow finishes, TraceLog automatically:

  • Stores an encrypted access token for your shop.
  • Registers the app/uninstalled webhook so TraceLog cleans up when you remove the app.
  • Registers a Web Pixel Extension in your shop's Customer Events. The pixel captures the checkout_completed event with order total, currency, line items and cart attributes — this is the revenue source.
  • Sends you to the wizard's verification step.
Revenue capture today

Revenue is captured by the Web Pixel Extension (checkout_completed event), not the orders/paid admin webhook. The webhook is gated behind Shopify's Protected Customer Data approval. If you need 100% server-side coverage (including accelerated checkouts that bypass the pixel), use the manual webhook setup — it does not require app approval.

info

You do not need to configure webhooks manually, copy any signing secrets, or paste any pixel code. TraceLog handles all of it during OAuth install.

The OAuth install captures revenue (webhook) and the checkout funnel (Web Pixel). To also capture storefront browsing — page views, clicks, sessions — add the TraceLog script to your theme:

  1. In Shopify Admin, go to Online Store → Themes → Edit code.
  2. Open theme.liquid.
  3. Paste the snippet just before </head>:
<script src="https://cdn.jsdelivr.net/npm/@tracelog/lib@latest/dist/browser/tracelog.js"></script>
<script>
tracelog.init({
integrations: {
tracelog: {
projectId: "PROJECT_ID",
shopify: true,
},
},
});
</script>
  1. Click Save.

The shopify: true option enables automatic session linking. TraceLog writes the session ID and visitor ID to Shopify's cart attributes, so webhook purchases and pixel funnel events are linked back to the customer's browsing session. This is what powers campaign attribution.

tip

Use the data-tlog-ignore attribute on form fields containing sensitive customer data (email, phone, address). TraceLog's PII sanitization catches most cases automatically; this attribute is an explicit guarantee.

Step 3: configure conversion tracking

For purchases to appear in your conversion KPIs and revenue dashboards:

  1. Go to the Events page in your project dashboard.
  2. Find the purchase event (it appears after the first order is received) and set its type to Conversion.
  3. Go to Revenue Tracking and configure:
    • Event name: purchase
    • Value source: Event field → value
    • Currency: match your Shopify shop currency.

Step 4: campaign attribution

Customer arrives from a campaign (utm_source=meta&utm_medium=cpc)
|
TraceLog captures UTM parameters in the session
|
shopify: true writes session ID to Shopify cart attributes
|
Customer reaches checkout → Web Pixel captures funnel events with session ID
|
Customer pays → Web Pixel emits checkout_completed with order total, currency,
items and cart attributes
|
TraceLog matches the pixel events to the session → revenue and funnel inherit
campaign data
|
Revenue and funnel appear under the correct campaign in your dashboard
info

Without session linking (shopify: true not set), purchases are stored as events but won't appear in conversion KPIs, revenue dashboards, or campaign analytics.

With session linking, purchases and funnel events attach to the customer's browsing session and appear in all conversion, revenue, and campaign metrics.

note

Accelerated checkouts (Shop Pay, Apple Pay, Google Pay) bypass the storefront cart and cannot carry cart attributes. Purchases from these flows are still recorded as conversion events and counted in revenue, but without session linking. Funnel events from accelerated checkouts are limited.

Manual webhook setup (no OAuth)

For merchants who prefer not to install the TraceLog Shopify app. Same revenue capture as OAuth (100% of paid orders), no funnel coverage.

Step 1: configure the webhook secret in TraceLog

  1. In the TraceLog dashboard, go to your Project Settings.
  2. Paste your Shopify webhook signing secret in the Shopify Webhook Secret field. (You'll get this secret in step 2.)

Step 2: create the webhook in Shopify

  1. Open Shopify Admin → Settings → Notifications.
  2. Scroll to Webhooks and click Create webhook.
  3. Configure:
    • Event: Order payment
    • Format: JSON
    • URL: https://api.tracelog.io/webhooks/shopify/orders/paid
  4. Click Save.
  5. Copy the Webhook signing secret Shopify shows.
  6. Paste it into TraceLog (step 1).

Step 3: install the storefront tracking script

Same as the OAuth path — see Step 2 above.

Privacy & compliance

Revenue webhook

Server-to-server. GDPR legal basis: contract performance (processing transaction data is necessary to fulfil the order). No visitor consent required.

Web Pixel funnel

Subject to Shopify's Customer Privacy framework. The pixel fires only when the visitor has granted analytics consent. Stores without an active cookie/consent banner won't capture funnel events from declining visitors. The pixel runs in Shopify's Strict sandbox: no DOM access, no localStorage, no third-party network calls beyond TraceLog's ingress.

Scopes requested during OAuth

  • read_script_tags, write_script_tags — manage the optional storefront script tag (legacy, for stores not editing theme.liquid directly).
  • read_themes — required by Shopify for app store eligibility.
  • write_pixels, read_customer_events — register the Web Pixel Extension and capture checkout_completed events (revenue + funnel).

TraceLog never requests scopes that expose customer email, phone, billing or shipping address. Customer identity is anonymous by design. read_orders is not requested today (revenue is captured via the pixel, not the admin webhook) — it will be added back once Shopify approves our Protected Customer Data application.

GDPR mandatory webhooks

TraceLog handles the three GDPR-mandated webhooks per Shopify spec: customers/data_request, customers/redact, shop/redact.

Domain matching

TraceLog matches incoming webhooks to your project using the shop domain that was connected during OAuth. The www. prefix is stripped automatically — www.my-store.com and my-store.com resolve to the same project.

  • If you use a custom domain (e.g. my-store.com), configure that as your project domain in TraceLog.
  • If you use the default Shopify domain (e.g. my-store.myshopify.com), configure that instead.

Verification

After setup, place a test order and check:

  1. Shopify side: Shopify Admin → Settings → Notifications → Webhooks — the delivery shows 200 OK.
  2. TraceLog side: the purchase event appears in your dashboard as a custom event named purchase. Funnel events (cart_viewed, checkout_started, checkout_completed, etc.) appear if the Web Pixel is registered and the visitor accepted consent.
tip

If the webhook returns 404, verify the domain in your TraceLog project matches the Shopify shop domain that you connected.

Idempotency

The same order is never recorded twice. Each order is deduplicated using Shopify's order id, so duplicate webhook deliveries (which Shopify retries on 5xx) are safely ignored.

Currency

warning

TraceLog logs a warning when the webhook currency does not match the project's configured revenue currency. Make sure your Shopify shop currency matches the currency configured in Revenue Tracking to avoid mismatched revenue data.

Troubleshooting

Funnel events are not arriving

  • Check the cookie / consent banner. The Web Pixel only fires when the visitor has granted analytics consent. Stores without an active banner won't capture any pixel data — install one (Shopify provides a free default in Settings → Customer privacy).
  • Confirm the pixel is registered. Shopify Admin → Settings → Customer events should list a TraceLog pixel as Connected.
  • If you installed the TraceLog app before May 2026, your OAuth scopes may predate the funnel-pixel feature. Open the TraceLog revenue wizard — if you see a yellow "Reauthorize Shopify" banner, click it to grant the new scopes. Always reauthorize through the TraceLog wizard rather than any banner Shopify shows in your admin; the TraceLog flow is the one validated end-to-end.

Webhook is returning 401 / Invalid HMAC

The signing secret in TraceLog does not match the one Shopify is using. Re-copy the secret from Shopify and paste it again in TraceLog.

Webhook is returning 404

The shop domain on the webhook delivery doesn't match any project in TraceLog. Make sure the Shopify shop domain you connected matches the project's configured domain (custom domain vs *.myshopify.com).

Currency missing on the order

The webhook handler skips events without a currency rather than guess. Confirm the store has a default currency set in Shopify settings.

Uninstalling

To disconnect the integration, uninstall the TraceLog app from Shopify Admin → Settings → Apps and sales channels. TraceLog receives the app/uninstalled webhook and automatically:

  • Deletes the registered Web Pixel from your shop.
  • Clears the encrypted access token.
  • Removes the registered webhooks from the project record.
  • Marks the integration as disconnected.

The tracking snippet in theme.liquid keeps sending storefront events as long as it is installed; remove it manually if you want all tracking to stop.