MarginGuard

Help & setup guide

MarginGuard reads your Shopify orders and refunds, works out which customers only ever buy with a discount code or return most of what they buy, and keeps a Klaviyo segment called MarginGuard: Don't discount current. You exclude that segment from your discount flows once; after that your promos skip those customers on their own.

Overview

What you get

The dashboard is one page. The number at the top is how many customers your enabled rules currently exclude, the switch turns the whole thing on and off, and the card below it is the single manual step you do in Klaviyo.

The dashboard header: the count of currently excluded customers and the protection switch. Nothing is written to Klaviyo while the switch is off.
The dashboard header: the count of currently excluded customers and the protection switch. Nothing is written to Klaviyo while the switch is off.

MarginGuard never sends email or SMS, never creates flows or campaigns, and never changes anything in your Shopify store. It reads orders, refunds and product costs, and writes a few properties on Klaviyo profiles that already exist in your account.

Step 1

Setup, about ten minutes

Five screens inside the Shopify admin. Nothing reaches Klaviyo until the last one.

Install from Shopify

MarginGuard requests read access to orders, refunds, products and customer email addresses, plus the two mandatory GDPR webhooks. It has no write scopes for your store.

Connect Klaviyo

Click Connect Klaviyo, approve on Klaviyo's own consent screen, and you land back in Shopify. No API keys to copy; the connection can be revoked from either side.

Import your order history

One click starts a Shopify bulk export. A few hundred orders take under a minute; tens of thousands can take much longer. You can close the tab — the import continues and the page picks it up when you return.

Run the readiness report

Your orders are scored locally and you see who crosses the thresholds, with the reason for each. Still nothing in Klaviyo at this point.

Activate

Start the 14-day trial. MarginGuard then stamps the matching Klaviyo profiles and creates the segment.

Step 4, the readiness report: how many customers crossed your thresholds, the split between discounters and returners, five example customers with the reason, and the cost-of-goods coverage found in your catalogue.
Step 4, the readiness report: how many customers crossed your thresholds, the split between discounters and returners, five example customers with the reason, and the cost-of-goods coverage found in your catalogue.

The readiness report is free and reversible: you can stop here, and you will still have seen exactly who MarginGuard would exclude and why.

Step 5, activation: the trial card. Nothing is charged until the trial ends, and cancelling is one click in Billing.
Step 5, activation: the trial card. Nothing is charged until the trial ends, and cancelling is one click in Billing.
Step 2 — the one manual part

Exclude the segment in your Klaviyo promos

Klaviyo does not let an app change who a flow or campaign is sent to. So MarginGuard keeps the segment accurate, and you point your discount sends away from it. Once per flow, about a minute each.

The dashboard reminds you until you confirm. <em>Open in Klaviyo</em> jumps straight to the segment; <em>I've added the exclusion</em> dismisses the reminder.
The dashboard reminds you until you confirm. Open in Klaviyo jumps straight to the segment; I've added the exclusion dismisses the reminder.

Flows

  1. In Klaviyo open Flows and pick a flow that hands out discount codes — welcome series, win-back, abandoned cart with a code.
  2. Click the trigger card at the top of the canvas, then open Flow filters.
  3. Add the filter Person is not in segmentMarginGuard: Don't discount.
  4. Save, and make sure the flow is back to Live. Repeat for every discount flow.

Filtering on the trigger stops flagged customers entering the flow at all. If you only want to skip the discount email inside a longer flow, put a conditional split on the same segment instead.

Campaigns

  1. Create the campaign as usual and go to the Recipients step.
  2. Scroll to Don't send to / Exclude and choose MarginGuard: Don't discount.
  3. Klaviyo drops those profiles from the send; the estimated recipient count updates immediately.

Klaviyo saves this per campaign, so add the exclusion to your campaign template or to a saved audience if you send promos often.

Two things worth knowing. Klaviyo's segment membership is dynamic: after MarginGuard writes a change, allow up to about ten minutes before the segment count moves. And Klaviyo occasionally renames these controls between UI versions — if a label reads slightly differently in your account, you are looking for the option that excludes a segment from the audience.

Back on the MarginGuard dashboard, press I've added the exclusion. The card switches to a confirmed state that shows the date and the last sync time, so you can tell at a glance that the loop is closed.

The rules

How a customer gets flagged

Three independent rules. A customer is excluded if any enabled rule matches, and you can see and change every number.

What counts as an order

An order is eligible when it was placed in the last 365 days, is paid, is fulfilled and was not cancelled. A customer needs at least two eligible orders before any rule can apply, so one-off buyers and first-time discount users are never flagged.

Serial discounter

At least 80% of the customer's eligible orders used a discount code, and at least two of them did.

Automatic discounts that need no code are ignored by default, so a store-wide sale does not turn your whole list into discounters. You can opt to count them in Advanced.

Frequent returner

At least two eligible orders were refunded and refunds cover 40% or more of their orders.

Measured by order count by default. You can switch to refunded value, which suits stores where a single large return matters more than several small ones.

Unprofitable — optional

Net margin across at least two orders is at or below zero, using Cost per item from your Shopify products.

Requires costs on at least 80% of the active catalogue, and at least 90% cost coverage for that particular customer's items. Off until you enable it.

A worked example

A customer has six eligible orders in the window; all six used a code (SPRING20, WELCOME10, VIP15, BF30). The discount rate is 6 ÷ 6 = 100%, above the 80% threshold, with more than two code orders — so the Serial discounter rule matches. One of those orders was refunded: 1 ÷ 6 = 16.7%, below the 40% return threshold, so the returner rule does not match. They are excluded on the discount rule alone, and the app records exactly that.

The flagged list: every customer with the rules that matched and the counts behind them. Filter by group, search by email, or keep any single customer in your emails.
The flagged list: every customer with the rules that matched and the counts behind them. Filter by group, search by email, or keep any single customer in your emails.
Evidence

Reading a customer's evidence

Click any customer. Every decision is shown with the orders behind it, so you can disagree with it on the spot.

A customer's evidence page: the matched rule with its exact ratio, the thresholds used at the time of scoring, and the full imported order history with discount codes, discount amounts, refunds and recorded margin. Order numbers link into the Shopify admin.
A customer's evidence page: the matched rule with its exact ratio, the thresholds used at the time of scoring, and the full imported order history with discount codes, discount amounts, refunds and recorded margin. Order numbers link into the Shopify admin.

About the numbers

  • Rules used for this score expands to the exact thresholds that were in force when the customer was last scored — useful after you change a setting.
  • Discount evidence shows a money amount when Shopify stored one. For percentage discounts you see the percentage and a conservative floor calculated from the post-discount total, labelled “at least”.
  • Recorded margin and cost basis only appear where product costs were available; otherwise the row says so rather than guessing.
  • Amounts in different currencies are never added together. Each row keeps its own currency.
Day to day

Tuning the rules and running the list

The Advanced panel: enable or disable each group, see the live thresholds, fine-tune them with a preview of who would be added or removed, refresh from Shopify, re-check imported orders, or pause Klaviyo updates.
The Advanced panel: enable or disable each group, see the live thresholds, fine-tune them with a preview of who would be added or removed, refresh from Shopify, re-check imported orders, or pause Klaviyo updates.
  • Groups to flag. Turn discounters, returners or unprofitable customers off independently. A disabled group stops contributing on the next successful Klaviyo update, so those profiles leave the segment.
  • Fine-tune these rules. Change the percentages, the minimum order counts or the lookback window, then preview: MarginGuard dry-runs the new rule over your existing orders and lists who would be added and removed before you apply it.
  • Keep in emails. On any customer row, this overrides every rule until you press Put back on list. Use it for VIPs, wholesale partners, staff and friends. Their evidence stays visible.
  • Refresh from Shopify pulls recent changes; Re-check customers re-scores the orders already imported. Day to day you need neither — new orders and refunds arrive over Shopify webhooks, and the scorers run on a schedule.
  • Pause automatic updates freezes writes to Klaviyo without clearing anything, which is what you want while you experiment with thresholds.
  • The protection switch is the big lever: off means the next sync marks every profile as not excluded and the Klaviyo segment empties. Turning it back on restores the list.
Under the hood

What is written to Klaviyo

Profiles are matched by email and only updated if they already exist. MarginGuard never creates profiles, subscribes anyone, or sends messages.

Profile propertyValuesWhat it means
marginguard_excludetrue / falseThe only property the segment is built on. True when an enabled rule matched, protection is on and the subscription is live.
marginguard_discount_dependencyserial / noneResult of the discount rule for this customer.
marginguard_return_dependencyhigh / noneResult of the return rule.
marginguard_margin_dependencynegative / positive / insufficient_orders / insufficient_cogs / noneResult of the optional margin rule, including why it could not be judged.
marginguard_last_evaluatedtimestampWhen this profile was last stamped.

The segment definition is a single condition: marginguard_exclude equals true. You can build your own segments on the dependency properties — for example “full-price buyers” as marginguard_discount_dependency equals none.

Customers who exist in Shopify but not in Klaviyo are skipped. If you uninstall MarginGuard, the properties and the segment remain in your Klaviyo account; delete the segment there if you no longer want it. Shopify's customer-redaction and shop-redaction requests are honoured automatically, and are described in the privacy notice.

Billing

$15 a month, or $150 a year

Reviewing your customers is free. You pay only for keeping the segment in sync — and the yearly plan costs two months less than paying monthly.

The Billing page: current status, and one button into Dodo's portal to change the card or cancel.
The Billing page: current status, and one button into Dodo's portal to change the card or cancel.

The 14-day free trial starts when you activate syncing, on either plan, and nothing is charged before it ends. You pick monthly or yearly on the trial card; the yearly plan is billed once a year. Payments run through Dodo Payments; card details never touch MarginGuard. Billing in the app shows the plan you are on, your trial end or next charge date, and opens the Dodo portal for payment changes and cancellation. To switch between monthly and yearly, cancel in the portal and start the other plan.

Cancelling keeps protection running until the end of the paid period. When the plan ends, MarginGuard clears the marginguard_* properties from your Klaviyo profiles, so the MarginGuard: Don't discount segment empties within a few minutes — nothing is silently excluded from your campaigns once you stop paying. The segment itself is left in place, your customer evidence stays readable in the app, and resubscribing refills the list on the next sync.

Troubleshooting

If something looks wrong

What you seeMost likely causeWhat to do
The flagged list is emptyNo customer crossed the thresholds, the import is still running, or every group is disabled.The dashboard states which. If the count reads Importing, wait; if it reads Not checked yet, run Re-check customers.
A flagged customer still received a discount emailThe segment is not excluded from that particular flow or campaign, the Klaviyo profile email differs from the Shopify order email, or the segment had not refreshed yet.Check the flow's filters, compare the two email addresses, and allow ten minutes after a sync.
“Klaviyo connection needs attention”The OAuth grant was revoked or expired.Open Klaviyo in the sidebar and reconnect. Scores stay intact; only writing is paused.
“Couldn't update Klaviyo”A write failed, usually a rate limit or a transient Klaviyo error.Press Retry update. Scheduled syncs also retry on their own.
The Klaviyo segment is empty although customers are flaggedProtection is off, updates are paused, or the subscription is not active.Check the switch, Pause automatic updates in Advanced, and the Billing page.
The import seems stuckLarge stores take a while; a failed export shows an error banner.Leave it and come back. If a banner reports an error, retry the import from the same screen.
Questions

Frequently asked

Does MarginGuard email my customers?

No. It writes profile properties and maintains one segment. What your flows and campaigns do with that segment is entirely yours.

Does it change anything in my Shopify store?

No. The app holds read scopes only — orders, refunds, products and customer emails. It cannot edit orders, products, discounts or customers.

Why is this customer on the list?

Click them. You get the matched rule, the exact ratio, the thresholds used, and every imported order with its codes and refunds.

Can I keep a customer in my emails anyway?

Yes — Keep in emails on their row overrides every rule until you undo it.

Will a store-wide sale flag everybody?

No. Automatic discounts that require no code are ignored by default; only entered discount codes count.

What if I have no product costs in Shopify?

The two main rules work without costs. The optional margin rule stays unavailable until Cost per item covers at least 80% of your active catalogue.

What happens to my data if I uninstall?

MarginGuard stops reading your store. The Klaviyo properties and the segment remain in your own account. Shopify's redaction requests are honoured automatically; see the privacy notice.

Contact

Still stuck? Write to us.

Use Feedback inside the app, or email admin@shelfcompass.com with your *.myshopify.com domain and what you expected to happen. Never send access tokens or API keys. We answer within one business day.