Shopify analytics: revenue by channel
ProductLense connects to Shopify and attributes every payment, refund and renewal to the channel, campaign and landing page that first brought the customer. Shopify paid orders, refunds and customers, attributed to the channel that brought each buyer.
Setup steps
- In Shopify admin, open Settings → Apps and sales channels → Develop apps and create a custom app.
- Give it the read_orders and read_customers Admin API scopes, install it, and copy the access token.
- In ProductLense, open Settings → Billing connections → Shopify and paste the shop domain, token and client secret.
- In the custom app, add a webhook endpoint with the URL ProductLense shows after you save the connection (pattern https://api.productlense.app/api/webhooks/{provider}/{connection_id}).
- ProductLense backfills 12 months of paid orders.
Credentials and permissions
| Field | Secret | Where to find it |
|---|---|---|
| Shop domain | No | Your myshopify.com domain, for example acme.myshopify.com. |
| Admin API access token | Yes, encrypted at rest | The shpat_... token from a custom app with read_orders and read_customers scopes. |
| Webhook signing secret | Yes, encrypted at rest | The custom app’s client secret, used to sign webhooks. |
Webhook
URL pattern, shown with your connection id after you save:
https://api.productlense.app/api/webhooks/shopify/{connection_id}Events: orders/paid, orders/updated, refunds/create, customers/create, customers/update
Verification: X-Shopify-Hmac-Sha256 header: base64 HMAC of the body, plus a shop domain check.
What ProductLense reads
- Customers
- Customers with email.
- Subscriptions
- None: Shopify orders are one-off purchases.
- Payments
- Paid orders.
- Refunds
- Order refunds.
- Fees
- Not in the orders API (fees live in the Payouts API), so recorded as 0.
What ProductLense never touches
- Never creates, changes, refunds or cancels anything: read-only API calls and incoming webhooks only.
- Never moves money, issues payouts, or reads bank account details.
- Never sees full card numbers; providers do not expose them.
- Never sends your customer data to the AI model: Ask and the daily insight see aggregates only.
Match payments to your users
Add the ProductLense script to theme.liquid and set a pl_user_id cart attribute for logged-in customers to match by id; otherwise ProductLense matches by customer email. See the Shopify install guide.
fetch('/cart/update.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ attributes: { pl_user_id: String(customerId) } }),
});Shopify and ProductLense: questions
- Does ProductLense work with Shopify?
- Yes. ProductLense connects to Shopify with shop domain, admin API access token, webhook signing secret, backfills 12 months of history, and stays current through signed webhooks plus a nightly reconcile. One connection is included on Starter; Growth and Scale allow every provider at once on the same site.
- What data does ProductLense read from Shopify?
- Customers, subscriptions, payments, refunds and fees, read-only. Payments: paid orders. Refunds: order refunds. Fees: not in the orders API (fees live in the Payouts API), so recorded as 0.
- Can ProductLense change anything in my Shopify account?
- No. ProductLense only makes read calls and receives webhooks. It never creates, changes, refunds or cancels anything, never moves money, and never sees card numbers. Credentials are encrypted at rest, and the AI features only ever see aggregated numbers, never your customers’ data.
- How does ProductLense match Shopify payments to visitors?
- Add the ProductLense script to theme.liquid and set a pl_user_id cart attribute for logged-in customers to match by id; otherwise ProductLense matches by customer email. See the Shopify install guide. Your site calls identify with the same user id after signup, and ProductLense follows the payment to that visitor’s first touch: source, medium, campaign and landing page.
- Are Shopify fees subtracted from revenue?
- Not in the orders API (fees live in the Payouts API), so recorded as 0. Net revenue is the charge minus the fee; refunds subtract the refunded amount and its fee. Profit per channel then subtracts ad spend.
Connect Shopify and see revenue by channel today.
Add the script, connect Stripe or any of 14 other billing providers, and see revenue by channel the same day.