Skip to content
MocklyDocs

Test

Shopify purchases

Count orders from your Shopify store for the variants their buyers saw, and test on revenue.

When a lander's buy button goes to a Shopify checkout, the sale happens on the store, not on your site. Without the store, an experiment can only be judged on the click, which stands in poorly for a sale: a headline can win clicks and lose buyers. Connect the store, and each order placed after a visit to your site counts as that visitor's purchase, worth what they paid, for the variants they saw.

Connect a store#

  1. In the editor's sidebar, open Site settings, then Shopify store.
  2. Type the store's address, such as glow.myshopify.com, or just the name in it, glow, and click Connect in Shopify.
  3. Shopify asks you to approve Mockly's app. It asks only to read the store's orders.
  4. Back in the studio, Publish. From then on, links on the site's pages to the store carry the visitor.

A store another site of your organization already uses is listed under Your organization's stores, to connect without going through Shopify again.

Connecting sets the site's currency, the one its goal values are in, to the store's. If they differ later, the panel says so and offers Use EUR for the site, or whichever the store's is, so revenue isn't mixed.

Test on revenue#

Link to the store as you would anyway, to a product page or a cart permalink, and judge the experiment on purchase, by revenue per visitor:

pages/index.tsx
import { Experiment, Page, Variant } from "mockly"; const OFFER_URL = "https://glow.myshopify.com/cart/41234567890:1"; export default function Lander() {  return (    <Page title="Glow Serum">      <Experiment name="hero-angle" goal="purchase" metric="revenue">        <Variant name="control">          <h1>The serum dermatologists keep on their own shelf</h1>        </Variant>        <Variant name="price">          <h1>Clinic-grade serum for $39, not $139</h1>        </Variant>      </Experiment>      <a href={OFFER_URL} track="cta-click">        Get 30% off today      </a>    </Page>  );}

metric="revenue" compares what visitors spend, buyers or not, so a variant that sells to fewer people but sells them more shows it. See Revenue. The click is still worth tracking, as cta-click here, for a secondary goal or a funnel.

purchase comes only from the store: nothing on a page records it, so don't put track="purchase" on a link. Holdouts, funnels, and Analytics count purchases too.

On the published site, Mockly adds to every link to the store's addresses, its myshopify.com one and its own domain:

  • A visitor token, _mkv, that ties the order to the visit. It's encrypted, bound to your site, different on every page view, and says nothing about the visitor to anyone else. A cart permalink also gets it as a hidden cart attribute, so it goes with the cart to checkout.
  • Where the visitor came from: the UTM tags and ad click IDs, such as fbclid, gclid, and ttclid, from the address they landed on, when the link doesn't have its own. They're kept for the visit, so a lander's second page passes them on too. The store's own analytics, and the ad platforms' pixels on it, then credit the ad.

Views Mockly doesn't count, such as bots', get no token.

What counts#

  • Orders placed within 30 days of the visit the token came from.
  • The value is the order's subtotal after discounts and refunds, without shipping or tax, in the store's currency.
  • Refunds and edits change it as they happen. A cancelled order stops counting. Test orders never count.
  • For the right variant: a purchase counts for the variant the buyer first saw, if it came after they saw it, as any goal does.

Orders arrive by Shopify's webhooks as Shopify sends them, and a check every 10 minutes catches any Shopify didn't send. An order without the token in it, because the buyer came back to the store later another way, is matched by Shopify's record of the buyer's visits, which can take a while to fill in, so it may count a little later.

The panel#

Shopify store, in Site settings, shows:

  • the orders counted in the Last 30 days, and what they're worth;
  • the Last order;
  • whether the live site links to the store yet: a store connected since the last publish says Publish to start;
  • a currency that doesn't match the store's.

Disconnecting#

Disconnect says first what it does. The store's orders stop counting for this site at once; purchases counted so far stay in results. When no other site of yours uses the store, Mockly's app is uninstalled from it. Publish, so links to the store stop carrying visitors.

If someone removes Mockly's app in Shopify, the panel says so, and the store's orders don't count until you connect it again. Orders placed before a store was first connected never count.

What Mockly keeps#

Which orders counted, for whom, and what they're worth, so later refunds can change them. No buyer's name, email, address, or what they bought. Shopify's privacy requests are honored: a buyer's request to be forgotten erases their order's record, and a store's erases everything about it.