For web shopsUpdated 12 min read
Affiliate marketing for Shopify stores: setup, tracking and terms
A guide to affiliate marketing for Shopify stores: how the tracking works technically, setup step by step and the program terms worth starting with.
Co-founder, product and technology
The short answer
Our Shopify app creates its own web pixel and builds tracking on a click ID and Shopify's checkout_completed event. The app is in the Shopify App Store, so a Shopify store installs it like any other app.
- Affiliate commission is only paid on completed, approved sales – unlike ads, where clicks and impressions cost money whether or not they turn into orders.
- If a Shopify order is refunded or cancelled, the commission is rejected automatically, and a partial refund reduces it – from app version 11-27, when the app has access to orders. Stores that installed before 14 November 2026 need to approve the new access.
- Sensible starting terms are a rate worked out backwards from your gross margin and a cookie window between 14 and 90 days, chosen by how long customers take to decide.
In this article · 6 sections
Shopify is a platform where affiliate tracking needs very little setup. The store already has a structured checkout, orders with unique IDs and a fixed checkout event a web pixel can listen to. Those are exactly the three things an affiliate network needs to be able to say: this sale came from this click, and the commission only stands if the order does.
We have built a dedicated Shopify integration for Affilyflow, and in this guide we walk through the whole chain: why the business model fits the economics of a Shopify store, how the tracking works under the hood, the setup step by step, what happens with refunds, and which program terms are sensible to start with.
Why the affiliate model suits a Shopify store
The difference between affiliate marketing and paid ads is when the money leaves your account. With ads you pay for the chance of a sale: clicks and impressions cost money whether or not orders come out of them. With affiliate marketing you pay a commission on orders that were actually completed – and with us, only once the sale has been approved.
That changes the risk profile fundamentally. An ad account can burn through a budget over a weekend without a single order. An affiliate program only costs something at the moment an affiliate has brought in a sale that holds. In return, ads scale with the budget here and now, while an affiliate program has to be built up: affiliates need to find the program, assess it and produce content. So the two channels do not compete – each covers its own part of growth.
| Affiliate marketing | Paid ads | |
|---|---|---|
| Risk | Low – you only pay for completed sales, and rejected orders cost no commission | High – clicks and impressions cost money whether or not they convert |
| Payment | Commission on the order value, after approval | Up front or ongoing, regardless of the result |
| Scale | Built up over time through affiliates and their content | Scales with the budget – and stops the day the budget does |
How the integration works technically
The chain starts with the click. When a visitor clicks an affiliate link, the click hits our server, which records it and sends the visitor on to your store with an afid parameter in the URL. Two things are locked to the click right there: the commission rate and the attribution window. If you lower the rate later, the old rate still applies to clicks that have already happened – we call that rate lock. Known bots and crawlers are filtered out at the same time and get neither a click record nor attribution.
In the store, our Shopify integration listens through a web pixel. The pixel subscribes to Shopify's checkout_completed event, so when a customer completes a purchase it sends the order ID, the amount and the click ID the customer carries to our server. From app version 11-27 (14 November 2026), Shopify's server also sends us the order when it is paid, cancelled or refunded. The server confirms the pixel's sale, or records it when the pixel didn't get through – for example because of an ad blocker – and the same order only counts once. The basis is the goods after discount without shipping and VAT, worked out from Shopify's own figures for the order. The server looks up the click, checks that it is still inside the cookie window that was locked at the click, and creates the conversion. The window is decided on the server from the click's actual time – the browser cannot lie about how old a click is.
The same order can never count twice: orders are deduplicated on the order ID per program. And everything is created as pending – a conversion never credits a balance automatically, it waits for approval. The whole flow is described in more detail under tracking.
Important
Everything is logged – including what did not become a sale
Every tracking event is written to an event log, including checkouts without an affiliate reference. That makes it possible to troubleshoot the setup with data instead of guesswork.
Setup step by step
Install the app
Install the Affilyflow app in Shopify. It creates the web pixel and your Affilyflow account itself, so there are no theme files to edit and no account to create first. If you already have an account with us, you connect it in the app with a six-digit code from the dashboard. You find the app in the Shopify App Store at apps.shopify.com/affilyflow. Write to us and we will let you know.
Choose your terms
Choose the commission rate and cookie window in the app, and write a description affiliates can assess. There is no subscription – the program only costs something when there are sales. Sales in any currency with a daily ECB rate are recorded and converted to Danish kroner at the rate on the day of the sale – the rate is locked on the sale. Balance, commission and payouts are settled in Danish kroner (DKK) today.
Make a test purchase
Click the test link in the Affilyflow app and complete a purchase in the store. The test sale is free, is marked Test under Sales and does not count in any figures or invoices, so it needs neither approval nor rejection. That way you know the chain works before the first affiliate gets going.
Become visible to affiliates
The program appears in our program directory as soon as it is active – via the Shopify app once you have chosen a commission in the app; if you create the account on affilyflow.com, once your email is confirmed.
Handle sales as they come in
New sales are pending. You have the program's approval period (30–90 days) to reject them with a reason – after that they are approved automatically, so a sale is never pending longer than the program's period of at most 90 days.
Tip
The test purchase is your most important step
Test all the way to a completed checkout – not just that the link redirects. The test sale through the app's test link is free and does not need rejecting, but it proves that the whole chain from click to recorded sale works.
Refunds: corrected automatically
The classic weak spot in an affiliate setup is what happens after the sale. A customer changes their mind and the order is refunded – but the commission is still in the system. With the Shopify app from version 11-27, Shopify's server reports the refund to us: a full refund or a cancellation rejects the sale automatically, and a partial refund reduces the commission proportionally. If you installed the app before 14 November 2026, this only happens once you have approved the app's new access to orders in Shopify – until then a refunded order is a manual clawback that you reject in the dashboard with a reason.
The same automation exists for the WooCommerce plugin and Stripe: if a WooCommerce order is refunded or cancelled, or a Stripe payment is refunded or disputed, the commission is rejected automatically – even if the sale has already been approved – and the affiliate is notified.
Program terms: where a Shopify store should start
The commission rate has to make the numbers work for both sides. Start from your gross margin and your average order value and work backwards: what can you pay for a sale and still make money? A worked example: if you sell for DKK 800 excluding VAT with a gross margin of 40 %, you have DKK 320 to play with per order. A total price of 10 % costs you DKK 80: DKK 64 in commission to the affiliate and DKK 16 in network fee – and leaves DKK 240 for everything else. Note that we calculate commission on the order value excluding VAT – via the Shopify app on the value of the goods without shipping and VAT.
You choose the cookie window yourself, between 14 and 90 days. A short window suits impulse purchases with a short decision time, a long one suits more expensive products where the customer compares for weeks. If in doubt, start with 30 days – that is our recommendation and the default in the dashboard and the Shopify app. You can adjust it later, and every click keeps the window that applied when it happened.
- Rate: work backwards from gross margin and order value – and remember the rate only costs anything on sales that hold
- Cookie window: 14–90 days, chosen by how long customers take to decide
- Description: write who the program is for and which channels you want – affiliates pick programs they can stand behind, and who you should go after yourself is covered in how to choose affiliates for your program
One more thing is worth knowing before you set the rate: it can only be lowered once every 30 days, and clicks that have already happened keep their locked rate. The rule is enforced by the database, not just the dashboard. So set a rate you can stand by – not a teaser rate you will have to cut after launch.
The economics: your total price and the affiliate's rate
Our business model is simple: you set your total price per sale. Our network fee is 20 % of it, and the other 80 % goes to the affiliate. If you set your total price at 10 % of an order worth DKK 1,000 excluding VAT, the sale costs DKK 100: the affiliate gets DKK 80, and DKK 20 is the network fee. There is no subscription and no fixed costs – no sales, no bill. The fee can only be changed by us, and like the rate rule it is enforced by the database. Read more about the model under payments, and the technical description of the app is in the docs under tracking on Shopify.
For affiliates, only approved commission can be paid out, and the payout threshold is DKK 100 – approved commission is paid out automatically on the first banking day of the month. That matters to you as a store too: your affiliates know pending sales cannot be withdrawn, so your approval is the real milestone. The faster you handle sales, the more attractive your program is to work for.
Important
Approve the new access to orders
Refunds, personal discount codes and sales from Shopify's server need the app to have access to orders. New installs grant it at install. If you installed the app before 14 November 2026, approve the new access in Shopify when the app asks – until then only the pixel reports sales (and it waits for the customer's consent to marketing), and you have to reject a refunded order yourself within the approval period.
If you want the full plan for the program – from recruitment to the numbers you should follow – read affiliate marketing strategy for web shops. If you are ready to get started, create your program – and if you have questions about your specific setup, write to us.
Frequently asked questions
Does affiliate marketing on Shopify need a developer?
No. Affilyflow's Shopify app creates the web pixel that listens for completed purchases itself, so there are no theme files to edit. The app is in the Shopify App Store, so a Shopify store installs it like any other app. The setup consists of installing the app, choosing your terms in the app and making a test purchase with the app's test link.
What happens to the commission if a Shopify order is refunded?
From app version 11-27, Shopify's server reports the refund: a full refund or a cancellation rejects the sale automatically, and a partial refund reduces the commission proportionally. This needs the app to have access to orders – new installs grant it at install, while stores that installed before 14 November 2026 have to approve it in Shopify. Until then the store rejects the sale itself in the dashboard within the approval period.
How quickly does a Shopify store have to approve affiliate sales?
All sales are created as pending, and the store has the program's approval period (30–90 days) to reject them with a reason. If nothing happens before the deadline, the sale is approved automatically. Only approved commission can be paid out to the affiliate.
What does it cost to run an affiliate program on Shopify?
There is no subscription with Affilyflow. The store sets its total price per sale; the network fee is 20 % of it, and the other 80 % goes to the affiliate. Via the Shopify app, commission is calculated on the goods after discount without shipping and VAT. Rejected sales cost nothing.
Further reading
More articles
- For web shops11 min readContribution margin: formula, example and calculatorContribution margin is what a sale leaves after its variable costs. See the formula, the margin ratio, a worked example and what a sale can cost in marketing.
- For web shops8 min readHow much does it cost to start an online store? Year-one budgetWhat it costs to start an online store: platform, payments, shipping, registration, VAT, bookkeeping and marketing – with a 12-month budget you can fill in.
- For web shops9 min readEcommerce conversion rate optimization: 15 checksEcommerce conversion rate optimization: calculate your conversion rate, 15 checks for product page, cart and checkout – and why it decides if affiliates pick you.

Written by
Co-founder, product and technology
Builds Affilyflow – the affiliate network from Denmark where businesses and affiliates can see exactly what their partnership delivers.
Found a number that no longer holds? Write to us – we will correct the article.