Shopify Integration

Connect Your Shopify Store to Creator Ad Attribution

Castlytics listens to your Shopify order webhooks and automatically matches every order to the creator campaign that drove it — no manual reconciliation.

Discount code matching, LTV tracking, and per-creator ROAS — all automatic.

What the Shopify integration does

Three automated workflows that connect your creator campaigns to real order data.

🏷️

Auto-sync discount codes

Create a campaign in Castlytics and the discount code is automatically registered. When an order uses that code in Shopify, the conversion fires in Castlytics without any manual work.

📦

Match orders to campaigns

Every Shopify order is checked against active campaign promo codes and tracking link visits. The first matching campaign gets credit. Your dashboard shows orders, revenue, and ROAS per creator.

📈

Track customer LTV by source

When a customer is acquired through a creator campaign, Castlytics tags future orders from that customer to the original source. See 90-day LTV and repeat purchase rates broken down by creator.

How the integration works

Castlytics connects to Shopify via the standard order webhook. No app store installation required.

01

Shopify fires an order webhook

POST orders/paid → Castlytics webhook endpoint

When an order is paid in your Shopify store, Shopify sends a webhook to Castlytics with the full order object — including line items, customer email, total revenue, and the discount_code field.

Uses Shopify's standard orders/paid webhook topic — no custom app required

02

Castlytics matches the discount code

discount_code field checked against active campaign codes

Castlytics checks the order's discount_code against every active campaign promo code. If there is a match, the order is attributed to that campaign. The revenue is recorded and ROAS is updated in your dashboard instantly.

Discount code matching is case-insensitive and handles partial matches

03

Tracking link visits are layered on top

Cookie-based attribution combined with code matching

If the same customer previously visited via a tracking link or vanity URL (detected by your tracker script), that session is also linked to the order. You get the full attribution picture: whether they clicked, typed the URL, or used the promo code.

Castlytics deduplicates automatically — each order is attributed once

What you see in your Castlytics dashboard

Once Shopify is connected, your dashboard shows real e-commerce metrics — not just clicks.

ROAS per creator

Revenue divided by estimated ad spend for each creator campaign. Compare ROI across your entire creator portfolio.

CAC per campaign

Customer acquisition cost calculated per Shopify order attributed to each campaign. Understand what you really pay to acquire each customer.

Repeat purchase rate

What percentage of customers acquired through each creator came back and bought again within 90 days. The best signal for creator audience quality.

Refund rate by channel

If customers from a specific creator have a higher refund rate, it may signal audience mismatch. Track this to avoid misleading ROAS numbers.

Connect Shopify to Castlytics

Four steps. No Shopify app store installation required.

1

Add the tracker script to your Shopify theme

In Shopify admin, go to Online Store → Themes → Edit code → theme.liquid. Paste the Castlytics script tag inside the <head> section.

<script src="https://castlytics.app/tracker.js" data-key="YOUR_KEY" async></script>
2

Register the Shopify order webhook

In your Castlytics dashboard, connect Shopify and enter your store URL. Castlytics registers the order webhook automatically — or you can add it manually in Shopify admin under Settings → Notifications → Webhooks.

// Shopify webhook config
{
  topic: "orders/paid",
  address: "https://castlytics.app/webhooks/shopify",
  format: "json"
}
3

Create campaigns with promo codes

Create a campaign in Castlytics for each creator and set the promo code. The code must exist in your Shopify discount codes — Castlytics matches the field exactly.

4

Verify the connection with a test order

Place a test order using a campaign promo code. It should appear in your Castlytics dashboard within 30 seconds. If it does not appear, check that the webhook is registered and the promo code matches exactly.

Shopify integration questions

How does the Castlytics Shopify integration work?

Castlytics registers an order webhook with your Shopify store. When an order is paid, Shopify sends the order data to Castlytics. We check the discount_code field against your active campaigns and record the conversion automatically.

Do I need to add code to my Shopify checkout?

No custom checkout code is required for discount code attribution — the webhook handles it. For tracking link and vanity URL attribution, add the Castlytics tracker script to your theme.liquid file. This is one script tag that takes about 2 minutes.

Can Castlytics track customer lifetime value by creator?

Yes. Once a customer is attributed to a creator campaign, Castlytics tags future orders from that customer to the original source. You can see 90-day LTV and repeat purchase rates broken down by creator in your dashboard.

What if a customer uses a discount code that is not tied to a campaign?

Castlytics only attributes orders when the discount code matches a code you configured in a campaign. Codes not tied to any campaign pass through without attribution — they will not appear in your Castlytics dashboard.

Does the integration work with Shopify Plus?

Yes. The integration uses Shopify's standard order webhook API, available on all plans including Basic, Shopify, Advanced, and Shopify Plus. No special Plus-only features are required.

Connect your Shopify store today

Free plan includes 3 campaigns, unlimited clicks, and 30-day attribution. No credit card required.

Create free account →