Connect Shopify, CJ and Meta to Analytics
Which keys to create, which permissions to give, and what PaidGoods Analytics reads with them.
PaidGoods Analytics reads your Shopify orders, your CJ Dropshipping costs and your Meta ad spend, and works out the profit each order leaves. It only reads. It never creates, changes, pays for or cancels anything in Shopify, CJ or Meta.
Set up a store for Analytics
If your store runs on Shopify or another platform, create a store for it in PaidGoods and choose Track profit for a store I run elsewhere. Give it the name your team knows it by and the currency you want reports in. Analytics is on from the start, and the store gets no storefront, checkout or Commerce setup: its PaidGoods address shows "Store not found" to anyone who visits it. The store opens straight in Analytics.
Analytics isn't open to every account yet. If you don't see that choice, PaidGoods turns Analytics on for your store instead.
To sell from the same store with PaidGoods later, open Business settings in the account menu and choose Also sell with PaidGoods Commerce. Nothing becomes public until you launch the store from Commerce.
Once Analytics is on, open Analytics → Connections.
Every key you paste is encrypted with your store's key and is never shown again. After saving you see the last four characters only. Replace key swaps it; Disconnect deletes it and keeps everything already imported.
Shopify
New connection: a Dev Dashboard app
Shopify no longer lets you create custom apps in the admin. Create one in the Shopify Dev Dashboard instead. The app must belong to the same Shopify organization as the store, or Shopify refuses the connection.
- Open the Shopify Dev Dashboard and create an app.
- In a new app version, add these access scopes:
read_ordersread_productsread_customers(the customer id only, to tell new from returning customers; PaidGoods stores a scrambled version of it, never a name or email)read_all_orders(optional; without it Shopify returns the last 60 days only)read_shopify_payments_accountsandread_shopify_payments_payouts(optional; actual Shopify Payments fees per order)
- Do not add any
write_scope. Analytics never uses one. - Release the version and install the app on your store.
- In Analytics → Connections → Shopify, paste the store address (
yourshop.myshopify.com), the app's Client ID and Client secret.
The staff account that installs the app should have the View product costs permission. Analytics then reads each variant's Cost per item and uses it as an estimated product cost. It never replaces a cost CJ actually charged, a cost you locked, or a cost rule you entered yourself. Without that permission product costs show as missing.
PaidGoods asks Shopify for a short-lived access token with these and renews it before it expires (about every 24 hours).
Existing connection: a legacy Admin API token
If your store already has a custom app created in the admin before 2026, paste its Admin API access token (shpat_…) instead of the client ID and secret, with the same read scopes. If you use Shopify webhooks from that app (below), also paste the webhook signing secret.
Webhooks (optional, makes orders appear within minutes)
Without webhooks Analytics reads new and changed orders every 30 minutes, and re-reads the last three days once a day. With webhooks it reads an order as soon as it changes.
In the app version, add webhook subscriptions to this address, which Connections shows after you connect:
https://api.paidgoods.com/v1/analytics/webhooks/shopify/<connection id>Topics: orders/create, orders/updated, orders/paid, orders/cancelled, orders/edited, refunds/create, order_transactions/create, fulfillments/create, fulfillments/update, app/uninstalled. Format: JSON.
Shopify signs each delivery with the app's client secret; PaidGoods checks the signature on every delivery and drops any that does not match. Analytics cannot create the subscriptions for you: that would be a write to your store.
What Test connection tells you
- The scopes Shopify actually granted.
- The oldest order PaidGoods can read. Without
read_all_ordersthis is about 60 days back, and customer counts say new to observed history. - Whether Shopify Payments fees are readable. If your store uses another gateway, fees come from the order's transaction when Shopify reports one; otherwise they show as estimated (from a fee rule you set) or missing, never as zero.
CJ Dropshipping
- In CJ, open Authorization → API and create an API key.
- In Analytics → Connections → CJ Dropshipping, paste the API key. The account email is optional.
PaidGoods gets and renews CJ's access tokens itself. CJ suspends API access after 30 days without a transaction on the account; if that happens the connection shows no longer authorized and you reactivate it on CJ's API page.
What PaidGoods reads: your paid CJ orders and their cost breakdown (product price, postage, taxes and duties with their type, tax handling, storage and outbound costs, label processing, first-mile shipping, re-dispatch fees, supplementary payments, dispute refunds), your wallet history, and supplier stock for the variants you sell. Wallet history and some stock reads use CJ API points (10 per call); orders and cost breakdowns do not.
CJ orders are matched to Shopify orders by the Shopify order id CJ stores on each order. A CJ order with no Shopify order is listed under Needs review, and so is any order CJ left out of an answer: its cost is unknown, not zero.
Each CJ charge keeps CJ's own label and field. Taxes and IOSS amounts stay unclassified until you confirm who pays them and whether they are recoverable. Fields CJ has not documented are shown with their raw value and never counted as a cost.
Meta Ads
Use a system user token from your own Business Manager.
- In Business Settings → Users → System users, add a system user (Employee role is enough).
- Assign your ad account to the system user with View performance access.
- Add your Meta app to the system user, then Generate new token with the permission
ads_readonly. Choose the expiring (60-day) token if Meta offers it; you replace it from Connections when it expires. - In Analytics → Connections → Meta Ads, paste the token. If your app requires it, also paste the app secret.
- Pick the ad accounts to import. With only one, it is picked for you.
What PaidGoods reads: campaigns, ad sets, ads with their creative (thumbnail, landing page, a preview that lasts about 24 hours), daily spend and outcomes at every level, and spend by viewer country. Meta keeps revising numbers for up to 28 days, so every sync re-reads the last 28 days.
Large backfills use Meta's asynchronous insights reports. Creating a report run does not change ads or budgets and needs only ads_read. The worker polls the run and imports its pages. Backfills and full resyncs use this path above 120 days or 100 ads. If Meta fails or expires the report, PaidGoods reads seven-day windows. Polling resumes after a worker restart. A waiting import attempt is marked cancelled with a note that the next poll is queued. The import run notes show which path was used.
- All spend counts, including ads with no purchases.
- Purchases come from Meta's ad set attribution settings (7-day click, 1-day view by default). These are Meta's numbers, shown apart from the orders PaidGoods can tie to an ad itself.
- A video metric Meta does not return (for example ThruPlay on some accounts) shows as unavailable, never zero.
- When the token expires, ad spend is marked disconnected, the spend already imported stays, and recommendations that depend on ads are held back until you replace the token.
Tie orders to ads (custom storefronts)
PaidGoods links an order to an ad only when the order itself says which ad it came from. It never guesses from Meta's purchase counts.
-
In each Meta ad, set URL parameters to:
utm_source=facebook&utm_medium=paid&utm_campaign={{campaign.id}}&utm_term={{adset.id}}&utm_content={{ad.id}} -
If your storefront is not Shopify's own theme (a custom or headless storefront that sends buyers to Shopify checkout), copy those parameters into the Shopify cart as cart attributes, after the visitor accepts marketing cookies:
// On every page load: remember the ad parameters from the landing URL for 7 days. const KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'fbclid']; const params = new URLSearchParams(location.search); if (KEYS.some((k) => params.has(k))) { const seen = Object.fromEntries(KEYS.filter((k) => params.get(k)).map((k) => [k, params.get(k)])); localStorage.setItem('pg_ad', JSON.stringify({ ...seen, at: Date.now() })); } // When you create the cart with the Storefront API (cartCreate), pass them as attributes. function adAttributes() { const ad = JSON.parse(localStorage.getItem('pg_ad') || 'null'); if (!ad || Date.now() - ad.at > 7 * 86400000) return []; return KEYS.filter((k) => ad[k]).map((k) => ({ key: `_${k}`, value: String(ad[k]) })); } // cartCreate(input: { lines, attributes: adAttributes() })Keys starting with
_are hidden from the buyer at checkout. Shopify copies cart attributes onto the order, where PaidGoods reads them. -
Place a test order through an ad link and open it in Analytics: the order shows the ad it came from.
Orders without these values stay unattributed. Their revenue still counts; only the ad link is missing.
Costs from a CSV (manual import)
When no connector covers a cost, upload a CSV in Analytics → Settings → Costs. Every upload is checked row by row first; nothing is imported while any row is invalid, and rows already imported are skipped.
Product cost rules (dated estimates):
| Column | Required | Example |
|---|---|---|
sku or variant_id | one of them for product costs | TS-BLK-L |
cost | yes | 6.50 |
currency | yes | USD |
effective_from | yes | 2026-09-01 |
effective_to, category, basis (per_unit or per_order), country, min_qty, max_qty, note | no |
Supplier invoice lines (actual costs on specific orders):
| Column | Required | Example |
|---|---|---|
invoice | yes | INV-2026-0042 |
order | yes, the Shopify order number or id | #1004 |
category | yes: goods, shipping, duties, import_vat, handling, other, payment_fx, unclassified | shipping |
amount, currency, date | yes | 3.40, USD, 2026-09-29 |
sku, label, payer | no |
Imported rows are marked as entered by you, not as data from a supplier.
Shopify Payments payout reconciliation
The cash API compares imported order-side payments and fees with Shopify's recorded payout net. It shows reserves, adjustments, refunds, chargebacks, fee differences, missing sources and any unexplained remainder. It does not change profit. Shopify's PAID status is not confirmation from your bank.
Both read_shopify_payments_accounts and read_shopify_payments_payouts are required. If Shopify refuses access, payout coverage is unavailable with the reason. PayPal, manual payments and other gateways are counted separately as not covered; direct Stripe and PayPal payout imports are not built.
Cash periods use the payout issue date in your reporting timezone. Outstanding charges include older orders still waiting for a paid payout. Missing source records or exchange rates remain unknown. Save a payout snapshot to keep the same figures across API, assistant, MCP and CSV exports.
The default attention threshold is the greater of one currency unit or 0.5% of the payout. Change it under Business settings → Payout checks (stored as payoutToleranceBp and payoutToleranceMinor.<CURRENCY> in the Analytics profile).
The screen is Profit → Payouts (see Analytics and reporting). Provider field shapes are tested with synthetic fixtures and still need verification on a connected account.
Orders paid through both Shopify Payments and another gateway show the other gateway's charge amount as not covered. Outstanding Shopify charges convert fees into the charge currency before calculating net. Missing exchange rates or balance evidence leave the affected amounts unknown. Saved payout snapshots retain their original figures when newer provider revisions arrive.