Integrate
Shopify
Connect your Shopify store to your program. Flow Affiliate reads the publisher’s click from each order and reports the sale for you, with no code in your store.
How it works
- A publisher's link sends the visitor to your store with
fg_click(the click) andfg_ref(the publisher's code) in the address. - The Flow Affiliate tracking app embed keeps them for 30 days in a first-party cookie, and adds them to the visitor's cart. Shopify carries cart attributes onto the order.
- When the order is paid, Shopify tells Flow Affiliate. The order becomes events in your program, attributed to the publisher whose click it carries.
Connect your store
In your program, open the Shopify section, enter your store's .myshopify.com address and choose Connect store. Shopify shows what the app may do (read orders and products, manage discounts) and asks you to install it. After that you're back in the program, connected.
- Owners, admins and developers can connect a store. Approve it in Shopify within 10 minutes, in the same browser.
- One store per program, and a store belongs to one program. To move it, disconnect it first.
- The program's app must convert on the web: a store is a website.
Turn on the app embed
The connection alone doesn't put anything in your storefront. In Shopify, open Online Store → Themes → Customize → App embeds, switch on Flow Affiliate tracking and save. Without it, orders carry no click and nothing is attributed.
What is sent, and when
| In your store | Sent to Flow Affiliate |
|---|---|
| A paid order that carries a click, from a customer no publisher brought yet | user.registered with the click and code, then purchase.completed |
| A paid order from a customer a publisher already brought, with or without a click, unless each order is credited on its own | purchase.completed |
| A paid order without a click, from anyone else | Nothing |
| A refund | purchase.refunded, see refunds |
A customer belongs to the publisher whose click brought their first attributed order, the same as a sign-up in an app. Their later orders count for that publisher too, unless you credit each order to the link it came from.
appUserIdstringshopify:<customer id>. A guest checkout has no customer, so each guest order is its own user: shopify-guest:<order id>. When each order is credited on its own, every order is: shopify-order:<order id>.
eventIdstringshopify-order:<order id> for the purchase and shopify-refund:<refund id> for a refund. The sign-up is registered:<appUserId>:<click id>.
amountintegerThe order's subtotal after discounts, before shipping, tax, duties and tips, in your store's currency, in minor units. When your prices include tax, the tax on the items is taken out. Goods for $150.00 with a 10% discount, $8.00 shipping and $10.80 tax: 13500.
metadataobjectsource: "shopify", shop, orderId, orderName (such as #1042), quantity (items ordered), discountCodes when the order used any, and taxesIncluded: true when your prices include tax. The sign-up also has country when the order has an address.
Flow Affiliate stores no names, email addresses, phone numbers or street addresses. Payout rules work as for any app: a percentage line on purchase.completed pays a share of amount. When your store sells in another currency than the payout's, the amount is converted at the ECB reference rate of the order's day first, see amounts and currencies.
Who an order is credited to
Once the store is connected, the Shopify section of your program has one choice: Credit each order to the link it came from. It applies to orders paid after you change it.
| Order | First publisher keeps the customer (default) | Credit each order to the link it came from |
|---|---|---|
| A customer’s first order through a link | Pays that publisher, and ties the customer to them | Pays that publisher |
| A later order through another publisher’s link | Pays the first publisher | Pays the other publisher |
| A later order without a click | Pays the first publisher | Not sent |
appUserId | shopify:<customer id>, or shopify-guest:<order id> for a guest | shopify-order:<order id> |
First publisher keeps the customer pays publishers for the customers they bring: repeat orders keep paying whoever brought the customer, as long as your offer pays on them.
Credit each order to the link it came from is how most shop networks work: the last click before an order wins, so a publisher is paid for exactly the orders their own link led to, and a returning customer who comes back through someone else’s link pays that publisher instead. Every attributed order is a customer of its own, so publishers see each one as a conversion, an offer that pays once per customer pays once per order, and the order must fall within your program’s attribution window from its own click.
Refunds
Every refund is sent as purchase.refunded with reversesEventId: "shopify-order:<order id>".
- A partial refund carries the refunded items in
amount, measured like the purchase: after discounts, without shipping or tax. It takes back the same share of a percentage commission. Refunding $45.00 of a $135.00 order takes back a third; the rest is still paid. A fixed commission per order stays until the whole order is refunded. - The refund that completes the order, once every item has been refunded in one refund or several, is sent without
amountand takes back whatever is left. - A refund of money without items, such as a goodwill refund or refunded shipping, has an
amountof 0 and takes nothing back.
What is still pending or approved is reduced or reversed straight away; money already paid out is flagged for review instead, as described under partial refunds. A cancelled order that Shopify refunds counts as a refund.
Discount codes
A discount code never attributes an order on its own. Publishers choose their own codes, so a store-wide code such as SUMMER10 could match one of them, and that publisher would be credited for every order that used it. The codes an order used are in metadata.discountCodes, so you can see them, and only the click decides who brought the customer.
Disconnecting
Disconnect in Flow Affiliate removes the app from your store. Uninstalling the app in Shopify disconnects it in Flow Affiliate too. Either way, what was already reported stays, with its earnings.
When a customer asks Shopify to erase their data, or 48 hours after you uninstall the app, Flow Affiliate replaces the Shopify ids in your program's records with a pseudonym that can't be traced back. Amounts and dates stay, for the books.
Testing
- Use a development store with test payments switched on (Shopify's Bogus Gateway).
- Connect it to the program and turn on the app embed.
- Open a publisher's link, or one of your own test links, and buy something with the test gateway.
- Open the program's event list: the order arrives in the sandbox as a sign-up and a purchase, with its amount. Refund it in Shopify and a refunded purchase follows.