E-commerce with affiliate tracking
How a Nordic e-commerce site got data-driven "Popular products" based on actual clicks, in just 30 minutes.
The problem
A Nordic e-commerce site selling electronics accessories had a "Popular products" section on its homepage. The problem? The list was manually curated and only updated every other week.
This led to several problems:
- Products that actually were popular never showed up
- Expired or sold-out products stayed on the list
- No insight into what visitors were actually interested in
- Manual work to keep the list up to date
The solution
With Savri they could switch to a data-driven approach:
Before
- ✗Manually curated product list
- ✗Updated every other week
- ✗No insight into visitor behavior
After
- ✓Based on actual clicks
- ✓Updates automatically every 30 minutes
- ✓Full insight in the Properties dashboard
The implementation
The integration consisted of two parts:
1. Track clicks with va()
On every affiliate link they added an event that is sent to Savri:
// When a user clicks "Buy at X"
va('event', 'affiliate_click', {
product_id: 'iphone-15-case-123',
category_slug: 'phone-cases',
partner_slug: 'teknikdelar'
});2. Fetch popular products via the API
On the server side they fetch data from the Popular Products API:
const { data, meta } = await fetch(
'https://savri.io/api/v1/popular/products?site_id=X&days=7&limit=12',
{ headers: { Authorization: 'Bearer bk_xxx' } }
).then(r => r.json());
// Fallback if there is too little data
if (meta.confidence === 'low') {
return getFallbackProducts();
}
return data.map(p => p.product_id);Key feature: Confidence
One of the most important features is the confidence level. The API returns how reliable the result is based on the amount of data:
| Level | Criteria | Recommendation |
|---|---|---|
| high | 100+ events, 10+ products | Show with confidence |
| medium | 20+ events | Show, possibly with a caveat |
| low | Fewer than 20 events | Use fallback |
This means the site always has something to show, even before enough click data has been collected.
Results
Since the integration, the e-commerce site has:
- Automatic updates - Popular products are based on the last 7 days of clicks
- No manual effort - The list takes care of itself
- Insights in the dashboard - Can see which products are trending in the Properties tab
- Robust fallback - Works even with little traffic
"The integration was surprisingly easy. The RFC documentation was clear, the API is standard REST with a Bearer token, and the confidence level makes fallback logic trivial."
Developer, Nordic e-commerce site
Want to do the same?
Follow our step-by-step guide to implement affiliate tracking on your site.